当前位置: 首页>>代码示例>>C#>>正文


C# DataClassesDataContext.Dispose方法代码示例

本文整理汇总了C#中DataClassesDataContext.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# DataClassesDataContext.Dispose方法的具体用法?C# DataClassesDataContext.Dispose怎么用?C# DataClassesDataContext.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataClassesDataContext的用法示例。


在下文中一共展示了DataClassesDataContext.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ListarFormasPagto

        public static List<FormaPagtoResumido> ListarFormasPagto(UsuarioResumido Usuario)
        {
            DataClassesDataContext dcdc = new DataClassesDataContext();

            /* SELECT * FROM ITCONPAGTO, FORMAPAGTO, TIPOPRAZO  
             * WHERE 
             *      ITCONPAGTO.CodFrmPgt = FORMAPAGTO.CodFrmPgt  AND 
             *      ITCONPAGTO.CodTipPrz = TIPOPRAZO.CodTipPrz  and 
             *      codemp = 1 AND 
             *      FILTROVENDA = 1 
             *      ORDER BY FORMAPAGTO.DesFrmPgt, FORMAPAGTO.CodFrmPgt
             * 
             */

            var dados = (from it in dcdc.ITCONPAGTOs 
                         join fp in dcdc.FORMAPAGTOs on it.CodFrmPgt equals fp.CodFrmPgt
                         join tp in dcdc.TIPOPRAZOs on it.CodTipPrz equals tp.CodTipPrz
                         where it.CodEmp.Equals(Usuario.CodEmp)
                         where fp.FiltroVenda.Equals(1)
                         orderby fp.DesFrmPgt
                         orderby fp.CodFrmPgt

                         select new FormaPagtoResumido  (
                                                            it.CodEmp, 
                                                            fp.CodFrmPgt, 
                                                            tp.CodTipPrz, 
                                                            fp.DesFrmPgt, 
                                                            tp.DesTipPrz,
                                                            String.Empty,
                                                            String.Empty,
                                                            fp.GeraParcelas.ToString()
                                                        )).ToList();




            //dcdc.Dispose();
            String vrGeraParcelas = "";
            String vrFormaPagto ="";

            foreach (FormaPagtoResumido item in dados)
            {
                if (vrGeraParcelas == "S" && item.CodFrmPgt.ToString() == vrFormaPagto)
                {
                    vrGeraParcelas = item.GeraParcelas.ToString();                    
                } 
                else 
                {
                    item.ValorCombo = (item.CodFrmPgt.ToString() + "|" + item.CodTipPrz.ToString().Trim());
                    item.LinhaCombo = (item.CodFrmPgt.ToString("000") + " - " + item.DesFrmPgt.Trim());

                    vrFormaPagto = item.CodFrmPgt.ToString();
                    vrGeraParcelas = item.GeraParcelas.ToString(); 
                }
            }

            dcdc.Dispose();
            return dados;
        }
开发者ID:prasist,项目名称:wb20,代码行数:59,代码来源:ClasseFormaPagto.cs

示例2: EditLanguage

 internal String EditLanguage(int ID)
 {
     String result = "<form id=\"editLanguage\" name=\"editLanguage\" action=\"#\" method=\"post\"><ul>";
     DataClassesDataContext d = new DataClassesDataContext();
     var query = from j in d.Jezyki where j.JezykID == ID select j;
     result += "<li class=\"PAMenuItems\">Nazwa języka: <input name=\"nameOfLanguage\" type=\"text\" value=\"" + query.First().Nazwa + "\" /></li>";
     result += "<input name=\"id\" type=\"hidden\" value=\"" + query.First().JezykID + "\" />";
     result += "<input type=\"submit\" value=\"Zapisz\" onClick=\"document.getElementById(\"editLanguage\").submit();\" />";
     result += "</ul></form>";
     d.Dispose();
     return result;
 }
开发者ID:sohelnewaz,项目名称:ForeignLanguageSchool,代码行数:12,代码来源:AdminPanel.aspx.cs

示例3: saveLanguageEdition

    internal String saveLanguageEdition(HttpRequest f)
    {
        int ID = Int32.Parse(f.Form["id"]);
        DataClassesDataContext d = new DataClassesDataContext();
        var query = from j in d.Jezyki where j.JezykID == ID select j;
        var jz = query.First();
        
        jz.Nazwa = f.Form["nameOfLanguage"];
        d.SubmitChanges();
        d.Dispose();

        String result = "Zapisano zmiany.";
        result += "<p><a href=\"?content=ManageLanguages\">Powrót</a></p>";
        return result;
    }
开发者ID:sohelnewaz,项目名称:ForeignLanguageSchool,代码行数:15,代码来源:AdminPanel.aspx.cs

示例4: LoginAndMailValidation

 private UserItemToRecover LoginAndMailValidation(String seekingLogin, String seekingMail)
 {
     DataClassesDataContext d = new DataClassesDataContext();
     var query = from u in d.Users where ((u.Login == seekingLogin) && (u.E_mail == seekingMail)) select u;
     bool notEmpty = query.Any();
     UserItemToRecover result;
     if( notEmpty ) {
         result = new UserItemToRecover(query.First().UserID);
     }
     else {
         result = null;
     }
     d.Dispose();
     return result;
 }
开发者ID:sohelnewaz,项目名称:ForeignLanguageSchool,代码行数:15,代码来源:PasswordRecovery.aspx.cs

示例5: Read

 public static Material Read(int id)
 {
     DataClassesDataContext d = new DataClassesDataContext();
     var MaterialCollection = from m in d.Materialy where m.ID == id select m;
     if ( MaterialCollection.Count() == 1 )
     {
         var Material = MaterialCollection.First();
         Material ReturnObject = new Material(Material.ID, Material.CourseID, Material.Title, Material.Type, Material.FilePath);
         d.Dispose();
         return ReturnObject;
     }
     else
     {
         throw new HttpResponseException(HttpStatusCode.NotFound);
     }
 }
开发者ID:sohelnewaz,项目名称:ForeignLanguageSchool,代码行数:16,代码来源:MaterialInput.cs

示例6: GetParametro

 public static List<ParametroResumido> GetParametro(int CodEmp)
 {
     DataClassesDataContext dcdc = new DataClassesDataContext();
     List<ParametroResumido> parametros = new List<ParametroResumido>();
     dcdc.PARAMETROs.Where(e => e.CodEmp == CodEmp).ToList().ForEach(e => parametros.Add(new ParametroResumido(
         e.CodEmp,
         e.TipMovPedPALM      == null ? 0 : e.TipMovPedPALM,
         e.TipMovPedPALMFE    == null ? 0 : e.TipMovPedPALMFE,
         e.CodTipPrc          == null ? 0 : e.CodTipPrc, 
         e.CodTipPrz          == null ? 0 : e.CodTipPrz, 
         e.NumPedIni          == null ? 0 : e.NumPedIni, 
         e.PARA_CasasDecimais == null ? '2' : e.PARA_CasasDecimais, 
         e.Prioridade_Cliente == null ? 0 : e.Prioridade_Cliente, 
         e.Prioridade_Merc    == null ? 0 : e.Prioridade_Merc, 
         e.Prioridade_Repr    == null ? 0 : e.Prioridade_Repr, 
         e.Prioridade_Tab     == null ? 0 : e.Prioridade_Tab,
         e.PARA_PriorGrupo == null ? 0 : e.PARA_PriorGrupo, e.PERCBLOQUEIO, e.SaldoPed, (e.PARA_UnidadeVenda == null ? 0 : e.PARA_UnidadeVenda), e.CondicaoTabLivreWeb, e.ExibirRazaoSocial, e.HostFtp, e.FtpUsuario, e.FtpSenha, e.PastaServidor, e.LayoutCombo)));
     dcdc.Dispose();
     return parametros;            
 }
开发者ID:prasist,项目名称:wb20,代码行数:20,代码来源:ClasseParametro.cs

示例7: insertCourse

    internal String insertCourse()
    {
        String result = "<form id=\"insertCourse\" name=\"insertCourse\" action=\"#\" method=\"post\">";
        DataClassesDataContext d = new DataClassesDataContext();
        
        result += "<ul>";

        // JĘZYK

        result += "<li class=\"PAMenuItems\">Język kursu: <select name=\"language\">";
        var languageQuery = from j in d.Jezyki select j;
        foreach (var r in languageQuery)
        {
            result += "<option value=\"" + r.JezykID + "\">" + r.Nazwa + "</option>";
        }
        result += "</select></li>";

        // POZIOM

        result += "<li class=\"PAMenuItems\">Poziom kursu: <select name=\"level\">";
        var levelQuery = from p in d.Poziomy select p;
        foreach (var r in levelQuery)
        {
            result += "<option value=\"" + r.PoziomID + "\">" + r.Nazwa + "</option>";
        }
        result += "</select></li>";

        // PROWADZĄCY

        result += "<li class=\"PAMenuItems\">Prowadzący: <select name=\"teacher\">";
        var teacherQuery = from u in d.Users select u;
        foreach (var r in teacherQuery)
        {
            result += "<option value=\"" + r.UserID + "\">" + r.Imie + " " + r.Nazwisko + "</option>";
        }
        result += "</select></li>";

        result += "<input name=\"type\" type=\"hidden\" value=\"1\" />";
        result += "<input name=\"inserting\" type=\"hidden\" value=\"true\" />";
        result += "<input type=\"submit\" value=\"Zapisz\" onClick=\"document.getElementById(\"insertCourse\").submit();\" />";
        result += "</ul></form>";
        d.Dispose();

        return result;
    }
开发者ID:sohelnewaz,项目名称:ForeignLanguageSchool,代码行数:45,代码来源:AdminPanel.aspx.cs

示例8: editCourse

    internal String editCourse(int ID)
    {
        String result = "<form id=\"editCourse\" name=\"editCourse\" action=\"#\" method=\"post\">";
        DataClassesDataContext d = new DataClassesDataContext();

        var query = from k in d.Kursy
                    join u in d.Users on k.IDprowadzacego equals u.UserID
                    join j in d.Jezyki on k.Jezyk equals j.JezykID
                    join p in d.Poziomy on k.Poziom equals p.PoziomID
                    where k.KursID == ID
                    select new {
                        IDkursu = k.KursID,
                        TypKursu = k.Typ,
                        Jezyk = j.Nazwa,
                        Poziom = p.Nazwa,
                        ImieProwadzacego = u.Imie,
                        NazwiskoProwadzacego = u.Nazwisko,
                        EMailProwadzacego = u.E_mail,

                        IDprowadzacego = k.IDprowadzacego,
                        IDjezyka = k.Jezyk,
                        IDpoziomu = k.Poziom
                    };

        result += "<ul>";

        // JĘZYK

        result += "<li class=\"PAMenuItems\">Język kursu: <select name=\"language\">";
        var languageQuery = from j in d.Jezyki select j;
        foreach (var r in languageQuery)
        {
            if (r.JezykID == query.First().IDjezyka)
            {
                result += "<option value=\"" + r.JezykID + "\" selected=\"selected\">" + r.Nazwa + "</option>";
            }
            else
            {
                result += "<option value=\"" + r.JezykID + "\">" + r.Nazwa + "</option>";
            }
        }
        result += "</select></li>";

        // POZIOM

        result += "<li class=\"PAMenuItems\">Poziom kursu: <select name=\"level\">";
        var levelQuery = from p in d.Poziomy select p;
        foreach (var r in levelQuery)
        {
            if (r.PoziomID == query.First().IDpoziomu)
            {
                result += "<option value=\"" + r.PoziomID + "\" selected=\"selected\">" + r.Nazwa + "</option>";
            }
            else
            {
                result += "<option value=\"" + r.PoziomID + "\">" + r.Nazwa + "</option>";
            }
        }
        result += "</select></li>";

        // PROWADZĄCY

        result += "<li class=\"PAMenuItems\">Prowadzący: <select name=\"teacher\">";
        var teacherQuery = from u in d.Users select u;
        foreach (var r in teacherQuery)
        {
            if (r.UserID == query.First().IDprowadzacego)
            {
                result += "<option value=\"" + r.UserID + "\" selected=\"selected\">" + r.Imie + " " + r.Nazwisko + "</option>";
            }
            else
            {
                result += "<option value=\"" + r.UserID + "\">" + r.Imie + " " + r.Nazwisko + "</option>";
            }
        }
        result += "</select></li>";

        // POZOZSTAŁE WARTOŚCI

        result += "<input name=\"idKursu\" type=\"hidden\" value=\"" + query.First().IDkursu + "\" />";
        result += "<li class=\"PAMenuItems\">Typ kursu: <input name=\"type\" type=\"text\" value=\"" + query.First().TypKursu + "\" /></li>";

        result += "<input type=\"submit\" value=\"Zapisz\" onClick=\"document.getElementById(\"editCourse\").submit();\" />";
        result += "</ul></form>";
        d.Dispose();

        return result;
    }
开发者ID:sohelnewaz,项目名称:ForeignLanguageSchool,代码行数:88,代码来源:AdminPanel.aspx.cs

示例9: saveUserEdition

 internal String saveUserEdition(HttpRequest f)
 {
     int ID = Int32.Parse(f.Form["id"]);
     DataClassesDataContext d = new DataClassesDataContext();
     var query = from u in d.Users where u.UserID == ID select u;
     Users us = query.First();
     us.Login = f.Form["login"];
     us.Imie = f.Form["imie"];
     us.Nazwisko = f.Form["nazwisko"];
     us.PhoneCountryCode = f.Form["numerPanstwa"];
     us.PhoneAreaCode = f.Form["numerWojewodztwa"];
     us.PhoneNumber = f.Form["numerTelefonu"];
     us.Street = f.Form["ulica"];
     if( f.Form["rights"] != "" ) us.CzyAdmin = int.Parse(f.Form["rights"]);
     if( f.Form["numerDomu"] != "" ) us.StreetNumber = int.Parse(f.Form["numerDomu"]);
     if( f.Form["numerMieszkania"] != "" ) us.FlatNumber = int.Parse(f.Form["numerMieszkania"]);
     us.PostCode = f.Form["kodPocztowy"];
     us.City = f.Form["miasto"];
     d.SubmitChanges();
     d.Dispose();
     
     String result = "Zapisano zmiany." + editUser(ID);
     return result;
 }
开发者ID:sohelnewaz,项目名称:ForeignLanguageSchool,代码行数:24,代码来源:AdminPanel.aspx.cs

示例10: editUser

 internal String editUser(int ID)
 {
     AdminRightsChecker userRights = new AdminRightsChecker(ID);
     String result = "<form id=\"editUser\" name=\"editUser\" action=\"#\" method=\"post\"><ul>";
     DataClassesDataContext d = new DataClassesDataContext();
     var query = from u in d.Users where u.UserID == ID select u;
     result += "<li class=\"PAMenuItems\">Login: <input name=\"login\" type=\"text\" value=\"" + query.First().Login + "\" /></li>";
     result += "<li class=\"PAMenuItems\">Imię: <input name=\"imie\" type=\"text\" value=\"" + query.First().Imie + "\" /></li>";
     result += "<li class=\"PAMenuItems\">Nazwisko: <input name=\"nazwisko\" type=\"text\" value=\"" + query.First().Nazwisko + "\" /></li>";
     result += "<li class=\"PAMenuItems\">Numer telefonu: +<input name=\"numerPanstwa\" type=\"text\" value=\"" + query.First().PhoneCountryCode + "\" />(<input name=\"numerWojewodztwa\" type=\"text\" value=\"" + query.First().PhoneAreaCode + "\" />)<input name=\"numerTelefonu\" type=\"text\" value=\"" + query.First().PhoneNumber + "\" /></li>";
     result += "<li class=\"PAMenuItems\">Adres:</li><li class=\"PAMenuItems\">Ulica: <input name=\"ulica\" type=\"text\" value=\"" + query.First().Street + "\" /><input name=\"numerDomu\" type=\"text\" value=\"" + query.First().StreetNumber + "\" />, mieszkania <input name=\"numerMieszkania\" type=\"text\" value=\"" + query.First().FlatNumber + "\" /></li>";
     result += "<li class=\"PAMenuItems\">Kod pocztowy: <input name=\"kodPocztowy\" type=\"text\" value=\"" + query.First().PostCode + "\" /> Miasto: <input name=\"miasto\" type=\"text\" value=\"" + query.First().City + "\" /></li>";
         result += "<li class=\"PAMenuItems\">Uprawnienia użytkownika: <select name=\"rights\"><option value=\"1\"";
         if (userRights.CzyAdmin()) result += " selected=\"selected\"";
         result += ">Administrator</option><option value=\"2\"";
         if (!(userRights.CzyAdmin()) && (userRights.CzySek())) result += " selected=\"selected\"";
         result += ">Sekretariat</option><option value=\"3\"";
         if (!(userRights.CzyAdmin()) && !(userRights.CzySek())) result += " selected=\"selected\"";
         result += ">Użytkownik</option></select></li>";
     result += "<input name=\"id\" type=\"hidden\" value=\"" + query.First().UserID + "\" />";
     result += "<input type=\"submit\" value=\"Zapisz\" onClick=\"document.getElementById(\"editUser\").submit();\" />";
     result += "</ul></form>";
     result += "<p><a href=\"?content=ShowUsers\">Powrót do listy użytkowników</a><br /><a href=\"?content=\">Powrót do panelu administracyjnego</a></p>";
     d.Dispose();
     return result;
 }
开发者ID:sohelnewaz,项目名称:ForeignLanguageSchool,代码行数:26,代码来源:AdminPanel.aspx.cs

示例11: InserePedido


//.........这里部分代码省略.........
                    itped.QTDUNIVENDA = iUniVend == 2 ? cQtdSolicitada : produto.Quantidade;

                    /*51954*/
                    //if (iUniVend == 2)
                    //{
                    //    //itped.VLRUNIVENDALIQ = ((double)produto.Preco / (double)cQtdSolicitada) - Convert.ToDouble(String.Format("{0:" + Funcoes.Decimais(pr) + "}", (((double)produto.Preco / (double)cQtdSolicitada) * ((double)produto.Desconto / 100))));
                    //    dValorUnitarioLiq    = (Convert.ToDecimal(sPrecoUnitarioReal) - (Convert.ToDecimal(sPrecoUnitarioReal) * produto.Desconto / 100));                        
                    //}
                    //else
                    //{
                    //    //itped.VLRUNIVENDALIQ = (double)produto.Preco - Convert.ToDouble(String.Format("{0:" + Funcoes.Decimais(pr) + "}", ((double)produto.Preco * (double)produto.Desconto / 100)));
                    //    dValorUnitarioLiq = (Convert.ToDecimal(sPrecoUnitario) - (Convert.ToDecimal(sPrecoUnitario) * produto.Desconto / 100));                        
                    //}

                    //dValorUnitarioLiq       = Convert.ToDecimal(String.Format("{0:" + Funcoes.Decimais(pr) + "}", dValorUnitarioLiq));
                    itped.VLRUNIVENDALIQ    = Convert.ToDouble(dValorUnitarioLiq);
                                                           
                    itped.QtdCan            = 0;
                    itped.QTDCANUNIVENDA    = 0;
                    itped.QtdTroca          = 0;
                    itped.VlrDes            = produto.Desconto; //FABIANO - 07/10/2011
                    itped.ValorDesconto     = 0;
                    itped.VlrDescRateio     = Convert.ToDecimal(String.Format("{0:" + Funcoes.Decimais(pr) + "}", (((decimal)itped.VLRUNIVENDALIQ * DescontoPedido / 100) * (decimal)itped.Qtd)));
                    itped.PerDescRateio     = Convert.ToDecimal(String.Format("{0:" + Funcoes.Decimais(pr) + "}", DescontoPedido)); 
                    itped.PercDescGordura   = 0;
                    itped.VLRADICIONAL      = 0;
                    itped.VLREMBALAGEM      = 0;

                    itped.VlrComiss = Convert.ToDecimal(String.Format("{0:" + Funcoes.Decimais(pr) + "}", (decimal)ClasseComissao.CalculaComissao(pr,
                                                                                    Convert.ToDecimal(String.Format("{0:" + Funcoes.Decimais(pr) + "}", iUniVend == 2 ? (double)(Convert.ToDecimal(itped.VLRUNIVENDALIQ) / Convert.ToDecimal(produto.QtdCaixa)) : (double)itped.VLRUNIVENDALIQ)), 
                                                                                    (decimal)itped.Qtd, 
                                                                                    0, 
                                                                                    0, 
                                                                                    comissao_vendedor,
                                                                                    dComissaoTabela, 
                                                                                    produto.Comissao, 
                                                                                    produto.Comissao, 
                                                                                    "N",
                                                                                    0, 
                                                                                    0, 
                                                                                    produto.Comissao, 
                                                                                    (decimal)comissao_televend,
                                                                                    (Int16)iIncideVend,
                                                                                    (Int16)iIncideTelev,
                                                                                    (Int32)produto.Codigo,
                                                                                    produto.Desconto)));

                    itped.ComissaoUsada = Convert.ToDecimal(String.Format("{0:" + Funcoes.Decimais(pr) + "}", (decimal)ClasseComissao.ComissaoUsada)); 
                    
                    //VALOR DA COMISSAO TELEVENDEDOR 
                    itped.COMISSAOTELEV         = Convert.ToDecimal(String.Format("{0:" + Funcoes.Decimais(pr) + "}", (decimal)ClasseComissao.CalculaComissao(pr,
                                                                                    Convert.ToDecimal(String.Format("{0:" + Funcoes.Decimais(pr) + "}", iUniVend == 2 ? (double)(Convert.ToDecimal(itped.VLRUNIVENDALIQ) / Convert.ToDecimal(produto.QtdCaixa)) : (double)itped.VLRUNIVENDALIQ)), 
                                                                                    (decimal)itped.Qtd, 
                                                                                    0, 
                                                                                    0, 
                                                                                    comissao_vendedor,
                                                                                    dComissaoTabela,
                                                                                    produto.ComissaoTel, 
                                                                                    produto.Comissao, 
                                                                                    "T", 
                                                                                    0, 
                                                                                    0, 
                                                                                    produto.Comissao, 
                                                                                    (decimal)comissao_televend,
                                                                                    (Int16)iIncideVend,
                                                                                    (Int16)iIncideTelev,
                                                                                    (Int32)produto.Codigo,
                                                                                    produto.Desconto)));

                    itped.COMISSAOUSADATELEV = (decimal)ClasseComissao.ComissaoUsadaTele;
                    itped.FatorComiss        = (decimal)ClasseComissao.FatorDesconto;

                    TotalComissao       += (decimal)itped.VlrComiss;
                    TotalComissaoTelev  += (decimal)itped.COMISSAOTELEV;

                    dcdc.ITENSPEDs.InsertOnSubmit(itped);
                }

                p.Comissao              = Convert.ToDecimal(String.Format("{0:" + Funcoes.Decimais(pr) + "}", TotalComissao));        //Valor da comissao VENDEDOR
                p.COMISSAOTELEV         = Convert.ToDecimal(String.Format("{0:" + Funcoes.Decimais(pr) + "}", TotalComissaoTelev));   //Valor da comissao do TELEVENDEDOR (OU SEGUNDO VENDEDOR)
                //p.PesoBruto             = cPesoTotal;
                //p.PesoLiq               = cPesoTotal;
                dcdc.SubmitChanges();
                dcdc.Dispose();
                return NumPed;
                

            }
            catch (Exception ex)
            {
                if (!String.IsNullOrEmpty(ex.Message))
                {
                    throw new Exception(ex.Message);
                }
                else
                {
                    return -1;
                }
            }
        }
开发者ID:prasist,项目名称:wb20,代码行数:101,代码来源:ClassePedido.cs

示例12: ListarClientes

        public static List<ClienteResumido> ListarClientes(UsuarioResumido u, ParametroResumido pr)
        {

            //CODIGO FEITO COM LINQ
            DataClassesDataContext dcdc = new DataClassesDataContext();
            var retorno = (from c in dcdc.CLIENTEs
                           join vc in dcdc.VENDCLIs on c.CodCli equals vc.CodCli
                           join ve in dcdc.VENDEDORs on vc.CodVen equals ve.CodVend
                           where c.Ativo != 'N'                 // clientes ativos
                           where c.Prospect != 'S'              // nao trazer prospects
                           where ve.Status.Equals('A')          // vendedores ativos
                           where ve.CodUsu.Equals(u.CodUsu)
                           where vc.CodEmp.Equals(u.CodEmp)
                           orderby (pr.ExibirRazaoSocial==1 ? c.RazSoc : c.NomFan)
                           select new ClienteResumido(c.CodCli, (c.CodCli + " - " + (pr.ExibirRazaoSocial == 1 ? c.RazSoc : c.NomFan)))).ToList();
            dcdc.Dispose();
            return retorno;
        }
开发者ID:prasist,项目名称:wb20,代码行数:18,代码来源:ClasseCliente.cs

示例13: RemoverReservaItensPedidoWeb

        public static Boolean RemoverReservaItensPedidoWeb(UsuarioResumido Usuario)
        {
            DataClassesDataContext dcdc = new DataClassesDataContext();
            var Itens = dcdc.ITPEDIDOWEBs.Where(p => p.CODEMP == Usuario.CodEmp && p.CODUSU == Usuario.CodUsu);

            dcdc.ITPEDIDOWEBs.DeleteAllOnSubmit(Itens);

            //EXECUTA PROCEDURE PARA CORRIGIR QTD RESERVADA SE O PEDIDO NAO FOI GRAVADO.
            dcdc.sp_corrige_reserva_webpedido();

            dcdc.SubmitChanges();
            dcdc.Dispose();

            return true;
        }
开发者ID:prasist,项目名称:wb20,代码行数:15,代码来源:ClassePedido.cs

示例14: RemoverReservaItemPedidoWeb

        public static Boolean RemoverReservaItemPedidoWeb(UsuarioResumido Usuario, Int32 NumPedWeb, Int32 CodServMerc)
        {
            DataClassesDataContext dcdc = new DataClassesDataContext();
            var Item = dcdc.ITPEDIDOWEBs.FirstOrDefault(p => p.NUMPEDWEB == NumPedWeb && p.CODSERVMERC == CodServMerc && p.CODEMP == Usuario.CodEmp && p.CODUSU == Usuario.CodUsu);

            dcdc.ITPEDIDOWEBs.DeleteOnSubmit(Item);

            //EXECUTA PROCEDURE PARA CORRIGIR QTD RESERVADA SE O PEDIDO NAO FOI GRAVADO.
            dcdc.sp_corrige_reserva_webpedido();

            dcdc.SubmitChanges();
            dcdc.Dispose();

            return true;
        }
开发者ID:prasist,项目名称:wb20,代码行数:15,代码来源:ClassePedido.cs

示例15: ReservarItemPedidoWeb

        public static Boolean ReservarItemPedidoWeb(UsuarioResumido Usuario, Int32 NumPedWeb, Int32 CodServMerc, Decimal Quantidade, ParametroResumido pr)
        {
            DataClassesDataContext dcdc = new DataClassesDataContext();

            //Decimal? Saldo = Convert.ToDecimal(dcdc.SERVMERCs.SingleOrDefault(sm => sm.CodServMerc.Equals((Int32)CodServMerc)).Saldo);
            //Decimal? QtdRes = Convert.ToDecimal(dcdc.SERVMERCs.SingleOrDefault(sm => sm.CodServMerc.Equals(CodServMerc)).QtdRes);
            Decimal? Saldo = 0;
            Decimal? QtdRes = 0;
            
            ClasseBanco csBanco = new ClasseBanco();

            var r = csBanco.Query("SELECT Saldo, QtdRes FROM SERVMERC WHERE CODSERVMERC = " + CodServMerc + "");
            if (r.Read())
            {
                Saldo = Convert.ToDecimal(r["SALDO"].ToString());
                QtdRes = Convert.ToDecimal(r["QtdRes"].ToString());
            }
            r.Close();
            r.Dispose();
            

            // verifica se a quantidade da mercadoria solicitada está disponível em estoque //
            if (pr.SaldoPed == 'S')
            {
                if ((Saldo - (QtdRes <= 0 ? 0 : QtdRes)) < Quantidade)
                {
                    throw new Exception("Quantidade indisponível da(s) mercadoria(s) solicitada(s). Se foi feita importação de Planilha/Arquivo OffLine, favor verificar a listagem de itens não atendidos.");
                }
            }

            // retorna os itens da mercadoria selecionada em outros pedidos  //
            var Itens = (from o in dcdc.ITPEDIDOWEBs
                         where (o.CODSERVMERC == CodServMerc)
                         where (o.CODEMP != Usuario.CodEmp || o.CODUSU != Usuario.CodUsu)
                         select new
                         {
                             o.CODSERVMERC,
                             o.QTDE
                         }).ToList();

            // soma a quantidade dos itens retornados
            var Soma = (Decimal)Itens.Select(c => c.QTDE).Sum();


            /* FABIANO -------------------------------------------------------------------------------
             Verifica saldo - reserva do produto - reserva de produto via web (ITPEDIDOWEB)
            ------------------------------------------------------------------------------------------*/

            if (pr.SaldoPed == 'S')
            {
                // se a soma dos itens em reserva for maior que a quantidade //
                if (((Saldo - QtdRes) - Soma) < Quantidade)
                {
                    throw new Exception("Quantidade solicitada é superior ao saldo disponível da mercadoria selecionada.");
                }
            }

            // ajusta as propriedades do Item
            ITPEDIDOWEB Item = new ITPEDIDOWEB();
            Item.NUMPEDWEB = NumPedWeb;
            Item.CODSERVMERC = CodServMerc;
            Item.CODEMP = Usuario.CodEmp;
            Item.CODUSU = Usuario.CodUsu;
            Item.QTDE = (Decimal)Quantidade;

            // grava o item na tabela //
            dcdc.ITPEDIDOWEBs.InsertOnSubmit(Item);
            dcdc.SubmitChanges();
            //dcdc.Dispose();

            //FABIANO
            //GRAVAR NA SERVMERC A QTD. RESERVADA NO MOMENTO DA INCLUSAO DO ITEM
            //SERVMERC prod = dcdc.SERVMERCs.Single(p => p.CodServMerc == CodServMerc);
            //prod.QtdRes = (prod.QtdRes == null ? (Convert.ToDouble(Quantidade)) : (prod.QtdRes + Convert.ToDouble(Quantidade)));
            //dcdc.SubmitChanges(); 
            String sQuantidade = Quantidade.ToString();//51747
            csBanco.ExecutarComando(" UPDATE SERVMERC SET QTDRES = ISNULL(QTDRES,0) + " + sQuantidade.Replace(',','.') + " WHERE CODSERVMERC = " + CodServMerc + "");

            dcdc.Dispose();

            return true;

        }
开发者ID:prasist,项目名称:wb20,代码行数:83,代码来源:ClassePedido.cs


注:本文中的DataClassesDataContext.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。