Exemplo n.º 1
0
 public ActionResult ProfileEdit(CLIENTS data)
 {
     db.Entry(data).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
     ViewBag.Message = "Вы успешно изменили свои данные.";
     return(View());
 }
Exemplo n.º 2
0
        public ActionResult Second(string Mode, string Code, string ANNEE, string SOCIETE, string TRIMESTRE)
        {
            int     ID = int.Parse(SOCIETE);
            string  SelectedSociete = BD.DECLARATIONS.Find(ID).SOCIETE;
            CLIENTS Client          = new CLIENTS();

            ViewBag.TRIMESTRE = TRIMESTRE;
            ViewBag.ANNEE     = ANNEE;
            ViewBag.SOCIETE   = SelectedSociete;
            ViewBag.Mode      = Mode;
            ViewBag.Code      = Code;
            LIGNES_DECLARATIONS_FACS Ligne = new LIGNES_DECLARATIONS_FACS();

            Ligne.DATE_AUTORISATION = DateTime.Today;
            Ligne.DATE_FACTURE      = DateTime.Today;
            if (Mode == "Edit")
            {
                List <LIGNES_DECLARATIONS_FACS> Liste = new List <LIGNES_DECLARATIONS_FACS>();
                if (Session["LignesFacture_FAC"] != null)
                {
                    Liste = (List <LIGNES_DECLARATIONS_FACS>)Session["LignesFacture_FAC"];
                    if (Liste.Count > 0)
                    {
                        int SelectedRow = int.Parse(Code);
                        Ligne = Liste.Where(Element => Element.NUMERO_ORDRE == SelectedRow).FirstOrDefault();
                    }
                }
            }
            return(View(Ligne));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        public void Delete(string id)
        {
            ClientModel server;

            CLIENTS.TryRemove(id, out server);
            Save();
        }
Exemplo n.º 4
0
        private void ClientConfirm(int id, String token, String dni, String telephone, String mobile)
        {
            TOKENS t = (from data in c.TOKENS
                        where data.VALUE_TOKEN.Contains(token)
                        select data).FirstOrDefault();

            c.TOKENS.Remove(t);
            c.SaveChanges();

            USERS u = (from data in c.USERS
                       where data.ID_USER == id
                       select data).FirstOrDefault();

            u.STATUS_USER = 2;
            c.SaveChanges();

            CLIENTS x = new CLIENTS()
            {
                ID_USER          = id,
                DNI_CLIENT       = dni,
                TELEPHONE_CLIENT = telephone,
                MOBILE_CLIENT    = mobile
            };

            c.CLIENTS.Add(x);
            c.SaveChanges();
        }
Exemplo n.º 5
0
        /// <summary>
        /// 改
        /// </summary>
        /// <param name="model"></param>
        public void Update(ClientModel model)
        {
            var old_model = CLIENTS[model.Id];

            old_model.CheckNull("指定数据不存在");
            CLIENTS.TryUpdate(model.Id, model, old_model).CheckIsFalse("更新失败");
            Save();
        }
Exemplo n.º 6
0
        public ActionResult Supprimer(int idRv, int idCl, int idCr, DateTime jour)
        {
            CLIENTS  cl = cx.CLIENTS.ToList().Single(x => x.ID == idCl);
            CRENEAUX cr = cx.CRENEAUX.ToList().Single(x => x.ID == idCr);

            ViewData["nomClient"]    = cl.NOM;
            ViewData["prenomClient"] = cl.PRENOM;
            ViewData["jour"]         = jour;
            ViewData["hFin"]         = cr.HFIN;
            ViewData["mFin"]         = cr.MFIN;
            ViewData["hDebut"]       = cr.HDEBUT;
            ViewData["mDebut"]       = cr.MDEBUT;
            ViewData["idRv"]         = idRv;
            ViewData["idCr"]         = idCr;
            return(View());
        }
Exemplo n.º 7
0
        public ActionResult NouveauClient(string titreClient, string nomClient, string prenomClient, int idMed, int hDebut, int mDebut, int hFin, int mFin, DateTime jour)
        {
            CLIENTS cl = new CLIENTS()
            {
                ID = cx.CLIENTS.Max(x => x.ID) + 1, TITRE = titreClient, NOM = nomClient, PRENOM = prenomClient
            };

            cx.CLIENTS.Add(cl);
            cx.SaveChanges();
            ViewData["idMed"]  = idMed;
            ViewData["hDebut"] = hDebut;
            ViewData["mDebut"] = mDebut;
            ViewData["hFin"]   = hFin;
            ViewData["mFin"]   = mFin;
            ViewData["jour"]   = jour;
            return(RedirectToAction("Reserver", new { idMed, hDebut, mDebut, hFin, mFin, jour }));
        }
Exemplo n.º 8
0
        public ActionResult Login(CLIENTS user)
        {
            var acc = db.CLIENTS.Single(u => u.LOGIN == user.LOGIN && u.PASSWORD == user.PASSWORD);

            if (acc != null)
            {
                Session["UserID"]    = acc.ID_CLIENT.ToString();
                Session["UserLogin"] = acc.LOGIN.ToString();
                Session["UserName"]  = acc.IM.ToString();
                Session["UserOt"]    = acc.OT.ToString();
                return(RedirectToAction("Profile"));
            }
            else
            {
                ModelState.AddModelError("", "Логин или пароль введён неверно.");
            }
            return(View());
        }
Exemplo n.º 9
0
        private void Create_Click(object sender, RoutedEventArgs e)
        {
            USERS User = new USERS()
            {
                LOGIN = "******", PASSWORD = "******"
            };

            ADDRESS Adress = new ADDRESS()
            {
                CITY    = "Минск",
                FLAT    = 33,
                HOUSE   = "2",
                HOUSING = "-",
                STREET  = "Яна Чечота",
                STATE   = "Беларусь"
            };

            CLIENTS Client = new CLIENTS()
            {
                FIRSTNAME   = "Настя",
                FATHERSNAME = "Павловна",
                BDAY        = DateTime.Now,
                GENDER      = "ж",
                PHONE       = "37544429181",
                ID_PASSPORT = "2131231231231",
                SURNAME     = "Стальмашенко",
                ADDRESS     = Adress,
            };

            Client.USERS.Add(User);
            //BALANCE Bal = new BALANCE()
            //{
            //    Bal
            //}
            using (Context db = new Context())
            {
                db.CLIENTS.Add(Client);
                db.SaveChanges();
            }
            Close();
            workplace work = new workplace();

            work.ShowDialog();
        }
Exemplo n.º 10
0
        public ActionResult Form(string Mode, string Type, string Code)
        {
            dynamic Result = null;
            int     ID     = int.Parse(Code);

            if (Type == "Client")
            {
                if (Mode == "Create")
                {
                    Result       = new CLIENTS();
                    ViewBag.Mode = "Nouveau";
                }
                if (Mode == "Edit")
                {
                    Result       = BD.CLIENTS.Where(clt => clt.ID == ID).FirstOrDefault();
                    ViewBag.Mode = "Modifier";
                }
                ViewBag.Type  = "client";
                ViewBag.Title = "CLIENTS";
            }
            if (Type == "Fournisseur")
            {
                if (Mode == "Create")
                {
                    Result       = new FOURNISSEURS();
                    ViewBag.Mode = "Nouveau";
                }
                if (Mode == "Edit")
                {
                    Result       = BD.FOURNISSEURS.Where(clt => clt.ID == ID).FirstOrDefault();
                    ViewBag.Mode = "Modifier";
                }
                ViewBag.Type  = "fournisseur";
                ViewBag.Title = "FOURNUISSEURS";
            }
            ViewBag.Code = Code;
            return(View(Result));
        }
Exemplo n.º 11
0
        public ActionResult Register(CLIENTS account)
        {
            if (ModelState.IsValid)
            {
                var acc = db.CLIENTS.SingleOrDefault(u => u.LOGIN == account.LOGIN);
                if (acc != null)
                {
                    ModelState.AddModelError("LOGIN", "Такой логин уже занят.");
                    return(View());
                }
                if (account.GENDER != "Мужской" && account.GENDER != "Женский")
                {
                    ModelState.AddModelError("GENDER", "Введите 'Мужской' или 'Женский'.");
                    return(View());
                }
                db.CLIENTS.Add(account);
                db.SaveChanges();

                ModelState.Clear();
                ViewBag.Message = account.IM + " " + account.OT + ", " + "вы успешно зарегистрировались!";
            }
            return(View());
        }
Exemplo n.º 12
0
        public ActionResult SendSecondEditForm(int Code, int ParamPassed)
        {
            string NUMERO_FACTURE      = Request.Params["NUMERO_FACTURE"] != null ? Request.Params["NUMERO_FACTURE"].ToString() : string.Empty;
            string DATE_FACTURE        = Request.Params["DATE_FACTURE"] != null ? Request.Params["DATE_FACTURE"].ToString() : string.Empty;
            string MATRICULE           = Request.Params["MATRICULE"] != null ? Request.Params["MATRICULE"].ToString() : string.Empty;
            string client              = Request.Params["client"] != null ? Request.Params["client"].ToString() : string.Empty;
            string TYPE_CLIENT         = Request.Params["TYPE_CLIENT"] != null ? Request.Params["TYPE_CLIENT"].ToString() : string.Empty;
            string PRIX_HT             = Request.Params["PRIX_HT"] != null ? Request.Params["PRIX_HT"].ToString() : string.Empty;
            string TVA                 = Request.Params["TVA"] != null ? Request.Params["TVA"].ToString() : string.Empty;
            string FODEC               = Request.Params["FODEC"] != null ? Request.Params["FODEC"].ToString() : string.Empty;
            string DROIT_CONSOMMATION  = Request.Params["DROIT_CONSOMMATION"] != null ? Request.Params["DROIT_CONSOMMATION"].ToString() : string.Empty;
            string NUMERO_AUTORISATION = Request.Params["NUMERO_AUTORISATION"] != null ? Request.Params["NUMERO_AUTORISATION"].ToString() : string.Empty;
            string DATE_AUTORISATION   = Request.Params["DATE_AUTORISATION"] != null ? Request.Params["DATE_AUTORISATION"].ToString() : string.Empty;
            string ACTION              = Request.Params["ACTION"] != null ? Request.Params["ACTION"].ToString() : string.Empty;

            #region DELETE
            if (ACTION == "DELETE")
            {
                LIGNES_DECLARATIONS_FACS Ligne = new LIGNES_DECLARATIONS_FACS();
                Ligne = BD.LIGNES_DECLARATIONS_FACS.Where(Element => Element.ID == ParamPassed).FirstOrDefault();
                BD.LIGNES_DECLARATIONS_FACS.Remove(Ligne);
                BD.SaveChanges();

                for (int i = 0; i < BD.LIGNES_DECLARATIONS_FACS.ToList().Count; i++)
                {
                    BD.LIGNES_DECLARATIONS_FACS.ToList().ElementAt(i).NUMERO_ORDRE = i + 1;
                    BD.SaveChanges();
                }
            }
            #endregion
            #region ADD
            if (ACTION == "ADD")
            {
                LIGNES_DECLARATIONS_FACS Ligne = new LIGNES_DECLARATIONS_FACS();
                if (ParamPassed <= 0)
                {
                    Ligne.NUMERO_ORDRE   = BD.LIGNES_DECLARATIONS_FACS.Where(Element => Element.DECLARATIONS_FACS.ID == Code).ToList().Count + 1;
                    Ligne.NUMERO_FACTURE = NUMERO_FACTURE;
                    Ligne.DATE_FACTURE   = DateTime.Parse(DATE_FACTURE);
                    int     ID_CLIENT      = int.Parse(client);
                    CLIENTS SelectedClient = BD.CLIENTS.Find(ID_CLIENT);
                    Ligne.CLIENT      = ID_CLIENT;
                    Ligne.CLIENTS     = SelectedClient;
                    Ligne.TYPE_CLIENT = int.Parse(TYPE_CLIENT);

                    if (PRIX_HT.Contains(','))
                    {
                        Ligne.PRIX_HT = decimal.Parse(PRIX_HT);
                    }
                    else
                    {
                        Ligne.PRIX_HT = decimal.Parse(PRIX_HT, CultureInfo.InvariantCulture);
                    }
                    int fodec = int.Parse(FODEC);
                    int droit_consommation = int.Parse(DROIT_CONSOMMATION);

                    decimal MONTANT_FODEC = (decimal)((Ligne.PRIX_HT * fodec) / 100);
                    decimal MONTANT_DROIT_CONSOMMATION = (decimal)((Ligne.PRIX_HT * droit_consommation) / 100);

                    Ligne.FODEC                      = fodec;
                    Ligne.MONTANT_FODEC              = MONTANT_FODEC;
                    Ligne.DROIT_CONSOMMATION         = droit_consommation;
                    Ligne.MONTANT_DROIT_CONSOMMATION = MONTANT_DROIT_CONSOMMATION;



                    Ligne.TVA = int.Parse(TVA);
                    //Ligne.PRIX_HT = totale_ht;
                    Ligne.MONTANT_TVA         = ((Ligne.PRIX_HT + MONTANT_FODEC + MONTANT_DROIT_CONSOMMATION) * int.Parse(TVA)) / 100;
                    Ligne.NUMERO_AUTORISATION = NUMERO_AUTORISATION;
                    Ligne.DATE_AUTORISATION   = DateTime.Parse(DATE_AUTORISATION);
                    Ligne.DECLARATIONS_FACS   = BD.DECLARATIONS_FACS.Find(Code);
                    Ligne.DECLARATION_FAC     = Code;
                    BD.LIGNES_DECLARATIONS_FACS.Add(Ligne);
                    BD.SaveChanges();
                }
                if (ParamPassed > 0)
                {
                    Ligne = BD.LIGNES_DECLARATIONS_FACS.Where(Element => Element.DECLARATIONS_FACS.ID == Code).FirstOrDefault();
                    //Ligne.NUMERO_ORDRE = Liste.Count + 1;
                    Ligne.NUMERO_FACTURE = NUMERO_FACTURE;
                    Ligne.DATE_FACTURE   = DateTime.Parse(DATE_FACTURE);
                    int     ID_CLIENT      = int.Parse(client);
                    CLIENTS SelectedClient = BD.CLIENTS.Find(ID_CLIENT);
                    Ligne.CLIENT      = ID_CLIENT;
                    Ligne.CLIENTS     = SelectedClient;
                    Ligne.TYPE_CLIENT = int.Parse(TYPE_CLIENT);

                    if (PRIX_HT.Contains(','))
                    {
                        Ligne.PRIX_HT = decimal.Parse(PRIX_HT);
                    }
                    else
                    {
                        Ligne.PRIX_HT = decimal.Parse(PRIX_HT, CultureInfo.InvariantCulture);
                    }
                    int fodec = int.Parse(FODEC);
                    int droit_consommation = int.Parse(DROIT_CONSOMMATION);

                    decimal MONTANT_FODEC = (decimal)((Ligne.PRIX_HT * fodec) / 100);
                    decimal MONTANT_DROIT_CONSOMMATION = (decimal)((Ligne.PRIX_HT * droit_consommation) / 100);

                    Ligne.FODEC                      = fodec;
                    Ligne.MONTANT_FODEC              = MONTANT_FODEC;
                    Ligne.DROIT_CONSOMMATION         = droit_consommation;
                    Ligne.MONTANT_DROIT_CONSOMMATION = MONTANT_DROIT_CONSOMMATION;



                    Ligne.TVA = int.Parse(TVA);
                    //Ligne.PRIX_HT = totale_ht;
                    Ligne.MONTANT_TVA         = ((Ligne.PRIX_HT + MONTANT_FODEC + MONTANT_DROIT_CONSOMMATION) * int.Parse(TVA)) / 100;
                    Ligne.NUMERO_AUTORISATION = NUMERO_AUTORISATION;
                    Ligne.DATE_AUTORISATION   = DateTime.Parse(DATE_AUTORISATION);
                    BD.SaveChanges();
                }
            }
            #endregion
            if (ACTION == "VALIDATE")
            {
                #region SaveFile
                DECLARATIONS_FACS NouvelleDeclaration = BD.DECLARATIONS_FACS.Find(Code);
                FileInfo          info = new FileInfo("Fichier vide.TXT");
                string            nom  = "FAC_T" + NouvelleDeclaration.TRIMESTRE + "_" + NouvelleDeclaration.ANNEE.ToString().Substring(2);
                var fileStream         = System.IO.File.Open(Server.MapPath(@"~/Images/" + nom), FileMode.OpenOrCreate, FileAccess.ReadWrite);
                fileStream.Close();
                info = new FileInfo(Server.MapPath(@"~/Images/" + nom));
                //"c:\\Variables.txt", true, Encoding.ASCII
                //using (StreamWriter writer = info.CreateText())
                using (StreamWriter writer = new StreamWriter(Server.MapPath(@"~/Images/" + nom), false, Encoding.ASCII))
                {
                    string EF01 = NouvelleDeclaration.DECLARATIONS.MATRICULE;
                    string EF05 = NouvelleDeclaration.ANNEE.ToString();
                    string EF06 = "T" + NouvelleDeclaration.TRIMESTRE.ToString();
                    string EF07 = NouvelleDeclaration.DECLARATIONS.SOCIETE != null ? NouvelleDeclaration.DECLARATIONS.SOCIETE : string.Empty;;
                    string EF08 = NouvelleDeclaration.DECLARATIONS.ACTIVITE != null ? NouvelleDeclaration.DECLARATIONS.ACTIVITE : string.Empty;
                    string EF09 = NouvelleDeclaration.DECLARATIONS.VILLE != null ? NouvelleDeclaration.DECLARATIONS.VILLE : string.Empty;
                    string EF10 = NouvelleDeclaration.DECLARATIONS.RUE != null ? NouvelleDeclaration.DECLARATIONS.RUE : string.Empty;
                    string EF11 = NouvelleDeclaration.DECLARATIONS.NUMERO != null ? NouvelleDeclaration.DECLARATIONS.NUMERO : string.Empty;
                    string EF12 = NouvelleDeclaration.DECLARATIONS.CODE_POSTAL != null ? NouvelleDeclaration.DECLARATIONS.CODE_POSTAL : string.Empty;
                    string EF13 = string.Empty;
                    while (EF07.Length < 40)
                    {
                        EF07 = EF07 + " ";
                    }
                    while (EF08.Length < 40)
                    {
                        EF08 = EF08 + " ";
                    }
                    while (EF09.Length < 40)
                    {
                        EF09 = EF09 + " ";
                    }
                    while (EF10.Length < 72)
                    {
                        EF10 = EF10 + " ";
                    }
                    while (EF11.Length < 4)
                    {
                        EF11 = EF11 + " ";
                    }
                    while (EF12.Length < 4)
                    {
                        EF12 = EF12 + " ";
                    }
                    while (EF13.Length < 111)
                    {
                        EF13 = EF13 + " ";
                    }
                    string FirstLine = "EF" + EF01 + EF05 + EF06 + EF07 + EF08 + EF09 + EF10 + EF11 + EF12 + EF13;
                    writer.WriteLine(FirstLine);
                    List <LIGNES_DECLARATIONS_FACS> NouvelleListe = BD.LIGNES_DECLARATIONS_FACS.Where(Element => Element.DECLARATIONS_FACS.ID == NouvelleDeclaration.ID).ToList();

                    decimal SumTotal             = 0;
                    decimal SumTva               = 0;
                    decimal SumFodec             = 0;
                    decimal SumDroitConsommation = 0;
                    int     NumeroOrdre          = 1;
                    foreach (LIGNES_DECLARATIONS_FACS Ligne in NouvelleListe)
                    {
                        CLIENTS SelectedClient = BD.CLIENTS.Find(Ligne.CLIENT);
                        string  DF07           = NumeroOrdre.ToString("000000");                                             //6
                        string  DF08           = Ligne.NUMERO_FACTURE;                                                       //20
                        string  DF09           = Ligne.DATE_FACTURE.ToShortDateString().Replace("/", "");                    //8
                        string  DF10           = Ligne.TYPE_CLIENT.ToString();                                               //1
                        string  DF11           = SelectedClient.ID_FISCAL != null ? SelectedClient.ID_FISCAL : string.Empty; //13
                        string  DF12           = SelectedClient.NOM != null ? SelectedClient.NOM : string.Empty;             //40
                        string  DF13           = SelectedClient.ADRESSE != null ? SelectedClient.ADRESSE : string.Empty;     //120
                        string  DF14           = Ligne.NUMERO_AUTORISATION;                                                  //20
                        string  DF15           = Ligne.DATE_AUTORISATION.ToShortDateString().Replace("/", "");               //8
                        SumTotal += Ligne.PRIX_HT;
                        string DF16 = Ligne.PRIX_HT.ToString("F3").Replace(",", "");                                         //15
                        SumFodec += Ligne.MONTANT_FODEC;
                        string DF17 = Ligne.FODEC.ToString("00000");                                                         //5
                        string DF18 = Ligne.MONTANT_FODEC.ToString("F3").Replace(",", "");                                   //15
                        SumDroitConsommation += Ligne.MONTANT_DROIT_CONSOMMATION;
                        string DF19 = Ligne.DROIT_CONSOMMATION.ToString("00000");                                            //5
                        string DF20 = Ligne.MONTANT_DROIT_CONSOMMATION.ToString("F3").Replace(",", "");                      //15
                        SumTva += Ligne.MONTANT_TVA;
                        string DF21 = Ligne.TVA.ToString("00000");                                                           //5
                        string DF22 = Ligne.MONTANT_TVA.ToString("F3").Replace(",", "");                                     //15

                        while (DF08.Length < 20)
                        {
                            DF08 = DF08 + " ";
                        }
                        while (DF11.Length < 13)
                        {
                            DF11 = DF11 + " ";
                        }
                        while (DF12.Length < 40)
                        {
                            DF12 = DF12 + " ";
                        }
                        while (DF13.Length < 120)
                        {
                            DF13 = DF13 + " ";
                        }
                        if (DF13.Length > 120)
                        {
                            DF13 = DF13.Substring(0, 120);
                        }
                        while (DF14.Length < 20)
                        {
                            DF14 = DF14 + " ";
                        }
                        while (DF16.Length < 15)
                        {
                            DF16 = "0" + DF16;
                        }
                        while (DF18.Length < 15)
                        {
                            DF18 = "0" + DF18;
                        }
                        while (DF20.Length < 15)
                        {
                            DF20 = "0" + DF20;
                        }
                        while (DF22.Length < 15)
                        {
                            DF22 = "0" + DF22;
                        }
                        string SubLine = "DF" + EF01 + EF05 + EF06 + DF07 + DF08 + DF09 + DF10 + DF11 + DF12 + DF13 + DF14 + DF15 + DF16 + DF17 + DF18 + DF19 + DF20 + DF21 + DF22;
                        writer.WriteLine(SubLine);
                        NumeroOrdre++;
                    }
                    string TF007 = NouvelleListe.Count.ToString("000000"); //6
                    string TF08  = string.Empty;                           //230
                    while (TF08.Length < 230)
                    {
                        TF08 = TF08 + " ";
                    }
                    string TF09 = SumTotal.ToString("F3").Replace(",", "");             //15
                    string TF10 = "00000";                                              //50
                    string TF11 = SumFodec.ToString("F3").Replace(",", "");             //15
                    string TF12 = "00000";                                              //5
                    string TF13 = SumDroitConsommation.ToString("F3").Replace(",", ""); //15
                    string TF14 = "00000";
                    string TF15 = SumTva.ToString("F3").Replace(",", "");               //15
                    while (TF09.Length < 15)
                    {
                        TF09 = "0" + TF09;
                    }
                    while (TF11.Length < 15)
                    {
                        TF11 = "0" + TF11;
                    }
                    while (TF13.Length < 15)
                    {
                        TF13 = "0" + TF13;
                    }
                    while (TF15.Length < 15)
                    {
                        TF15 = "0" + TF15;
                    }
                    string LastLine = "TF" + EF01 + EF05 + EF06 + TF007 + TF08 + TF09 + TF10 + TF11 + TF12 + TF13 + TF14 + TF15;
                    writer.WriteLine(LastLine);
                }
                byte[] fileBytes = System.IO.File.ReadAllBytes(Server.MapPath(@"~/Images/" + nom));
                NouvelleDeclaration.DATA = fileBytes;
                BD.SaveChanges();
                #endregion
                Session.Clear();
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("SecondEdit", "DeclarationFAC", new { ParamPassed = -1, @Code = Code }));
        }
Exemplo n.º 13
0
        public ActionResult Send(string Mode, string Type, string Code)
        {
            string Nom       = Request["Nom"] != null ? Request["Nom"].ToString() : string.Empty;
            string Contact   = Request["Contact"] != null ? Request["Contact"].ToString() : string.Empty;
            string Telephone = Request["Telephone"] != null ? Request["Telephone"].ToString() : string.Empty;
            string Adresse   = Request["Adresse"] != null ? Request["Adresse"].ToString() : string.Empty;
            string Fax       = Request["Fax"] != null ? Request["Fax"].ToString() : string.Empty;
            string Email     = Request["Email"] != null ? Request["Email"].ToString() : string.Empty;
            string SiteWeb   = Request["SiteWeb"] != null ? Request["SiteWeb"].ToString() : string.Empty;
            string IdFiscal  = Request["IdFiscal"] != null ? Request["IdFiscal"].ToString() : string.Empty;
            string AI        = Request["AI"] != null ? Request["AI"].ToString() : string.Empty;
            string NIS       = Request["NIS"] != null ? Request["NIS"].ToString() : string.Empty;
            string RC        = Request["RC"] != null ? Request["RC"].ToString() : string.Empty;
            string RIB       = Request["RIB"] != null ? Request["RIB"].ToString() : string.Empty;

            if (Type == "client")
            {
                if (Mode == "Nouveau")
                {
                    CLIENTS Client = new CLIENTS();
                    Client.NOM       = Nom;
                    Client.CONTACT   = Contact;
                    Client.TELEPHONE = Telephone;
                    Client.ADRESSE   = Adresse;
                    Client.FAX       = Fax;
                    Client.EMAIL     = Email;
                    Client.SITE_WEB  = SiteWeb;
                    Client.ID_FISCAL = IdFiscal;
                    Client.AI        = AI;
                    Client.NIS       = NIS;
                    Client.RC        = RC;
                    Client.RIB       = RIB;
                    int max = BD.CLIENTS.Count() != 0 ? BD.CLIENTS.Select(clt => clt.ID).Max() : 1;
                    Client.CODE = "CL" + max.ToString("0000");
                    BD.CLIENTS.Add(Client);
                    BD.SaveChanges();
                }
                if (Mode == "Modifier")
                {
                    int     ID     = int.Parse(Code);
                    CLIENTS Client = BD.CLIENTS.Where(clt => clt.ID == ID).FirstOrDefault();
                    Client.NOM       = Nom;
                    Client.CONTACT   = Contact;
                    Client.TELEPHONE = Telephone;
                    Client.ADRESSE   = Adresse;
                    Client.FAX       = Fax;
                    Client.EMAIL     = Email;
                    Client.SITE_WEB  = SiteWeb;
                    Client.ID_FISCAL = IdFiscal;
                    Client.AI        = AI;
                    Client.NIS       = NIS;
                    Client.RC        = RC;
                    Client.RIB       = RIB;
                    BD.SaveChanges();
                }
                return(RedirectToAction("Clients"));
            }
            if (Type == "fournisseur")
            {
                if (Mode == "Nouveau")
                {
                    FOURNISSEURS Fournisseur = new FOURNISSEURS();
                    Fournisseur.NOM       = Nom;
                    Fournisseur.CONTACT   = Contact;
                    Fournisseur.TELEPHONE = Telephone;
                    Fournisseur.ADRESSE   = Adresse;
                    Fournisseur.FAX       = Fax;
                    Fournisseur.EMAIL     = Email;
                    Fournisseur.SITE_WEB  = SiteWeb;
                    Fournisseur.ID_FISCAL = IdFiscal;
                    Fournisseur.AI        = AI;
                    Fournisseur.NIS       = NIS;
                    Fournisseur.RC        = RC;
                    Fournisseur.RIB       = RIB;
                    int max = BD.FOURNISSEURS.Count() != 0 ? BD.CLIENTS.Select(clt => clt.ID).Max() : 1;
                    Fournisseur.CODE = "FOU" + max.ToString("0000");
                    BD.FOURNISSEURS.Add(Fournisseur);
                    BD.SaveChanges();
                }
                if (Mode == "Modifier")
                {
                    int          ID          = int.Parse(Code);
                    FOURNISSEURS Fournisseur = BD.FOURNISSEURS.Where(clt => clt.ID == ID).FirstOrDefault();
                    Fournisseur.NOM       = Nom;
                    Fournisseur.CONTACT   = Contact;
                    Fournisseur.TELEPHONE = Telephone;
                    Fournisseur.ADRESSE   = Adresse;
                    Fournisseur.FAX       = Fax;
                    Fournisseur.EMAIL     = Email;
                    Fournisseur.SITE_WEB  = SiteWeb;
                    Fournisseur.ID_FISCAL = IdFiscal;
                    Fournisseur.AI        = AI;
                    Fournisseur.NIS       = NIS;
                    Fournisseur.RC        = RC;
                    Fournisseur.RIB       = RIB;
                    BD.SaveChanges();
                }
                return(RedirectToAction("Fournisseurs"));
            }
            return(RedirectToAction("Form"));
        }
Exemplo n.º 14
0
 /// <summary>
 /// 新增服务端
 /// </summary>
 /// <param name="model"></param>
 public void Add(ClientModel model)
 {
     CLIENTS.TryAdd(model.Id, model);
     Save();
 }
Exemplo n.º 15
0
        public ActionResult HistoriqueClient(string Code)
        {
            List <Historique> listeHistorique = new List <Historique>();
            int     ID     = int.Parse(Code);
            CLIENTS client = BD.CLIENTS.Where(fou => fou.ID == ID).FirstOrDefault();

            foreach (DEVIS_CLIENTS Devis in client.DEVIS_CLIENTS)
            {
                Historique Hist = new Historique();
                Hist.date     = Devis.DATE.ToShortDateString();
                Hist.type     = "DEVIS";
                Hist.code     = Devis.CODE;
                Hist.remarque = string.Empty;
                Hist.ttc      = Devis.TTC.ToString();
                listeHistorique.Add(Hist);
            }
            foreach (COMMANDES_CLIENTS Commande in client.COMMANDES_CLIENTS)
            {
                Historique Hist = new Historique();
                Hist.date     = Commande.DATE.ToShortDateString();
                Hist.type     = "COMMANDE";
                Hist.code     = Commande.CODE;
                Hist.remarque = string.Empty;
                Hist.ttc      = Commande.TTC.ToString();
                listeHistorique.Add(Hist);
            }
            foreach (BONS_LIVRAISONS_CLIENTS BonLivraison in client.BONS_LIVRAISONS_CLIENTS)
            {
                Historique Hist = new Historique();
                Hist.date     = BonLivraison.DATE.ToShortDateString();
                Hist.type     = "BON LIVRAISON";
                Hist.code     = BonLivraison.CODE;
                Hist.remarque = "NON VALIDEE";
                if (BonLivraison.VALIDER)
                {
                    Hist.remarque = "VALIDEE";
                }
                Hist.ttc = BonLivraison.TTC.ToString();
                listeHistorique.Add(Hist);
            }
            foreach (FACTURES_CLIENTS Facture in client.FACTURES_CLIENTS)
            {
                Historique Hist = new Historique();
                Hist.date     = Facture.DATE.ToShortDateString();
                Hist.type     = "FACTURE";
                Hist.code     = Facture.CODE;
                Hist.remarque = "NON PAYEE";
                if (Facture.PAYEE)
                {
                    Hist.remarque = "PAYEE";
                }
                Hist.ttc = Facture.TTC.ToString();
                listeHistorique.Add(Hist);
            }
            foreach (AVOIRS_CLIENTS Avoir in client.AVOIRS_CLIENTS)
            {
                Historique Hist = new Historique();
                Hist.date     = Avoir.DATE.ToShortDateString();
                Hist.type     = "AVOIR";
                Hist.code     = Avoir.CODE;
                Hist.remarque = "NON VALIDEE";
                if (Avoir.VALIDER)
                {
                    Hist.remarque = "VALIDEE";
                }
                Hist.ttc = Avoir.TTC.ToString();
                listeHistorique.Add(Hist);
            }
            ViewBag.CODE       = client.ID;
            ViewBag.LibClient  = client.NOM;
            ViewBag.CodeClient = client.CODE;
            return(View(listeHistorique));
        }
Exemplo n.º 16
0
        public ActionResult PrintHistoriqueClient(string CODE)
        {
            List <Historique> listeHistorique = new List <Historique>();
            int     ID     = int.Parse(CODE);
            CLIENTS client = BD.CLIENTS.Where(fou => fou.ID == ID).FirstOrDefault();

            foreach (DEVIS_CLIENTS Devis in client.DEVIS_CLIENTS)
            {
                Historique Hist = new Historique();
                Hist.date     = Devis.DATE.ToShortDateString();
                Hist.type     = "DEVIS";
                Hist.code     = Devis.CODE;
                Hist.remarque = string.Empty;
                Hist.ttc      = Devis.TTC.ToString();
                listeHistorique.Add(Hist);
            }
            foreach (COMMANDES_CLIENTS Commande in client.COMMANDES_CLIENTS)
            {
                Historique Hist = new Historique();
                Hist.date     = Commande.DATE.ToShortDateString();
                Hist.type     = "COMMANDE";
                Hist.code     = Commande.CODE;
                Hist.remarque = string.Empty;
                Hist.ttc      = Commande.TTC.ToString();
                listeHistorique.Add(Hist);
            }
            foreach (BONS_LIVRAISONS_CLIENTS BonLivraison in client.BONS_LIVRAISONS_CLIENTS)
            {
                Historique Hist = new Historique();
                Hist.date     = BonLivraison.DATE.ToShortDateString();
                Hist.type     = "BON LIVRAISON";
                Hist.code     = BonLivraison.CODE;
                Hist.remarque = "NON VALIDEE";
                if (BonLivraison.VALIDER)
                {
                    Hist.remarque = "VALIDEE";
                }
                Hist.ttc = BonLivraison.TTC.ToString();
                listeHistorique.Add(Hist);
            }
            foreach (FACTURES_CLIENTS Facture in client.FACTURES_CLIENTS)
            {
                Historique Hist = new Historique();
                Hist.date     = Facture.DATE.ToShortDateString();
                Hist.type     = "FACTURE";
                Hist.code     = Facture.CODE;
                Hist.remarque = "NON PAYEE";
                if (Facture.PAYEE)
                {
                    Hist.remarque = "PAYEE";
                }
                Hist.ttc = Facture.TTC.ToString();
                listeHistorique.Add(Hist);
            }
            foreach (AVOIRS_CLIENTS Avoir in client.AVOIRS_CLIENTS)
            {
                Historique Hist = new Historique();
                Hist.date     = Avoir.DATE.ToShortDateString();
                Hist.type     = "AVOIR";
                Hist.code     = Avoir.CODE;
                Hist.remarque = "NON VALIDEE";
                if (Avoir.VALIDER)
                {
                    Hist.remarque = "VALIDEE";
                }
                Hist.ttc = Avoir.TTC.ToString();
                listeHistorique.Add(Hist);
            }
            dynamic dt = from mouv in listeHistorique
                         select new
            {
                DATE     = mouv.date,
                TYPE     = mouv.type,
                CODE     = mouv.code,
                REMARQUE = mouv.remarque,
                TTC      = mouv.ttc
            };
            ReportDocument rptH     = new ReportDocument();
            string         FileName = Server.MapPath("/Reports/Historique.rpt");

            rptH.Load(FileName);
            rptH.SummaryInfo.ReportTitle = "Historique Client " + client.CODE;
            rptH.SetDataSource(dt);
            Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            return(File(stream, "application/pdf"));
        }
Exemplo n.º 17
0
        private void BImport_Click(object sender, EventArgs e)
        {
            XmlSerialization <CLIENTS> xmlSerialization = new XmlSerialization <CLIENTS>();

            CLIENTS cl = new CLIENTS();     // путь к файлу

            string filePath = @"xml\import.xml";

            cl = (CLIENTS)xmlSerialization.ReadData(filePath, cl);     //дерсериализация

            for (int i = 0; i < cl.CLIENT.Count; i++)
            {
                string clientName           = cl.CLIENT[i].Name;
                string clientSurname        = cl.CLIENT[i].Surname;
                string clientLastname       = cl.CLIENT[i].Lastname;
                string clientLogin          = cl.CLIENT[i].Login;
                string clientPassword       = cl.CLIENT[i].Password;
                string clientSeriaPassport  = cl.CLIENT[i].SeriaPassport;
                string clientNumberPassport = cl.CLIENT[i].NumberPassport;
                string clientDateOfBirth    = cl.CLIENT[i].DateOfBirth;
                string clientDesc           = cl.CLIENT[i].Deschotel;
                string clientCountDays      = cl.CLIENT[i].CountDaysLive;

                //добавление
                using (var context = new MyDbContext())
                {
                    var query = context.Clients.Where(x => x.login == clientLogin || x.numberPassport == clientPassword);

                    var client = new Client()
                    {
                        name           = clientName.ToString(),
                        surname        = clientSurname.ToString(),
                        lastname       = clientLastname.ToString(),
                        login          = clientLogin.ToString(),
                        password       = clientPassword.ToString(),
                        seriaPassport  = clientSeriaPassport.ToString(),
                        numberPassport = clientNumberPassport.ToString(),
                        dataOfBirth    = DateTime.Parse(clientDateOfBirth.ToString()),
                        countDaysLive  = Convert.ToInt32(clientCountDays),
                        deschotel      = clientDesc.ToString()
                    };

                    if (query.ToList().Count < 1)
                    {
                        context.Clients.Add(client);
                        context.SaveChanges();
                    }
                }



                for (int j = 0; j < cl.CLIENT[i].HOTELROOM.Count; j++)
                {
                    string hotelNomer       = cl.CLIENT[i].HOTELROOM[j].Nomer;
                    string hotelCountPeople = cl.CLIENT[i].HOTELROOM[j].CountPeople;
                    string hotelCategory    = cl.CLIENT[i].HOTELROOM[j].Category;
                    string hotelPayment     = cl.CLIENT[i].HOTELROOM[j].Payment;

                    using (var context = new MyDbContext())
                    {
                        var query = context.HotelRooms.Where(x => x.nomer == hotelNomer);

                        var hotelRoom = new HotelRoom()
                        {
                            nomer       = hotelNomer,
                            countPeople = Convert.ToInt32(hotelCountPeople),
                            category    = hotelCategory,
                            payment     = Convert.ToInt32(hotelPayment)
                        };

                        if (query.ToList().Count < 1)
                        {
                            context.HotelRooms.Add(hotelRoom);
                            context.SaveChanges();
                        }
                    }


                    for (int y = 0; y < cl.CLIENT[i].HOTELROOM[j].REGHOTELS.Count; y++)
                    {
                        string regStartlive = cl.CLIENT[i].HOTELROOM[j].REGHOTELS[y].StartLive.ToString();
                        string regEndLive   = cl.CLIENT[i].HOTELROOM[j].REGHOTELS[y].EndLive.ToString();
                        string regDescLive  = cl.CLIENT[i].HOTELROOM[j].REGHOTELS[y].Desclive.ToString();

                        using (var context = new MyDbContext())
                        {
                            var idFlat = context.HotelRooms.Where(x => x.nomer == hotelNomer).Select(x => x.idFlat).First();


                            //var idFlat = from x in context.HotelRooms
                            //             where x.nomer.ToString() == cl.CLIENT[i].HOTELROOM[j].Nomer.ToString()
                            //             select x.idFlat;

                            //foreach (var x in idFlat.ToList())
                            //{
                            //    idFlats = x;
                            //}

                            var idClient = context.Clients.Where(x => x.name == clientName && x.surname == clientSurname && x.lastname == clientLastname && x.seriaPassport == clientSeriaPassport && x.numberPassport == clientNumberPassport && x.login == clientLogin && x.password == clientPassword).Select(x => x.idClient).First();

                            //var idClient = from x in context.Clients
                            //                   where x.name.ToString() == cl.CLIENT[i].Name.ToString() && x.surname.ToString() == cl.CLIENT[i].Surname.ToString() && x.lastname.ToString() == cl.CLIENT[i].Lastname.ToString() && x.seriaPassport.ToString() == cl.CLIENT[i].SeriaPassport.ToString() && x.numberPassport.ToString() == cl.CLIENT[i].NumberPassport.ToString() && x.login.ToString() == cl.CLIENT[i].Login.ToString() && x.password.ToString() == cl.CLIENT[i].Password.ToString()
                            //                   select x.idClient;

                            //foreach (var x in idClient.ToList())
                            //{
                            //    idClients = x;
                            //}

                            int      idFlatTest = Convert.ToInt32(idFlat);
                            DateTime RS         = DateTime.Parse(DateTime.Parse(regStartlive).ToShortDateString().ToString());
                            DateTime RE         = DateTime.Parse(DateTime.Parse(regEndLive).ToShortDateString().ToString());



                            var query = context.RegHotels.Where(x => x.idFlat == idFlatTest && (RS >= x.startLive && x.endLive >= RS || RE >= x.startLive && x.endLive >= RE));

                            if (query.ToList().Count > 0)
                            {
                                MessageBox.Show("Это дата уже занята");
                            }

                            else
                            {
                                var regHotel = new RegHotel()
                                {
                                    idFlat    = Convert.ToInt32(idFlat),
                                    idClient  = Convert.ToInt32(idClient),
                                    startLive = DateTime.Parse(cl.CLIENT[i].HOTELROOM[j].REGHOTELS[y].StartLive.ToString()),
                                    endLive   = DateTime.Parse(cl.CLIENT[i].HOTELROOM[j].REGHOTELS[y].EndLive.ToString()),
                                    desclive  = cl.CLIENT[i].HOTELROOM[j].REGHOTELS[y].Desclive
                                };

                                context.RegHotels.Add(regHotel);
                                context.SaveChanges();
                            }
                        }
                    }
                }
            }
            MessageBox.Show("Импорт завершён");
        }
Exemplo n.º 18
0
 public void RemoveClient(CLIENTS clientToRemove)
 {
     _context.REMOVE_CLIENT(clientToRemove.ID_CLIENT);
 }
Exemplo n.º 19
0
 public void EditCLient(CLIENTS clientToEdit, string name, string surname, int phone_nr, string address)
 {
     _context.EDIT_CLIENT(clientToEdit.ID_CLIENT, name, surname, phone_nr, address);
 }