public ActionResult CreatEnseignant(Enseignant _Enseignant)
        {
            List <Niveau>         niveau     = repNiveau.GetAll(null, false).ToList();
            List <Formation>      formation  = repFor.GetAll(null, false).ToList();
            List <TypeSpecialite> specilaite = repSpec.GetAll(null, false).ToList();
            List <Cour>           cour       = repcour.GetAll(null, false).ToList();


            Repository <UserProfile> repuser     = new Repository <UserProfile>(AppConfig.DbConnexionString);
            Repository <Enseignant>  repetudiant = new Repository <Enseignant>(AppConfig.DbConnexionString);
            //   if (ModelState.IsValid)
            {
                WebSecurity.CreateUserAndAccount(_Enseignant.NCin + "-" + _Enseignant.Prenom, _Enseignant.MotdePasse);

                int    userid   = repuser.GetSingle(v => v.UserName == _Enseignant.NCin + "-" + _Enseignant.Prenom, false).UserId;
                string username = repuser.GetSingle(v => v.UserName == _Enseignant.NCin + "-" + _Enseignant.Prenom, false).UserName;
                Roles.AddUserToRole(username, "Enseignant");
                string pwd = _Enseignant.MotdePasse;
                _Enseignant.UserId = userid;
                repetudiant.Add(_Enseignant);



                string smtpAddress = "smtp.live.com";
                int    portNumber  = 587;
                bool   enableSSL   = true;

                string emailFrom = "*****@*****.**";
                string password  = "******";
                string emailTo   = _Enseignant.Email;
                string subject   = "Hello";
                string body      = "Votre mot de passe et :" + _Enseignant.MotdePasse + "Votre login est :" + _Enseignant.NCin + "-" + _Enseignant.Prenom;

                using (MailMessage mail = new MailMessage())
                {
                    mail.From = new MailAddress(emailFrom);
                    mail.To.Add(emailTo);
                    mail.Subject    = subject;
                    mail.Body       = body;
                    mail.IsBodyHtml = true;


                    using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                    {
                        smtp.Credentials = new NetworkCredential(emailFrom, password);
                        smtp.EnableSsl   = enableSSL;
                        smtp.Send(mail);
                        return(RedirectToAction("Index"));
                    }
                }
            }

            /* ViewBag.IdNiveau = new SelectList(niveau, "IdNiveau", "Libelle", _etudiant.Niveau);
             * ViewBag.IdFormation = new SelectList(formation, "IdFormation", "LibelleFormation", _etudiant.IdNiveauFormation);
             * ViewBag.IdSpecialite = new SelectList(specilaite, "IdSpecialite", "LibelleSpecialite", _etudiant.IdSpetialite);
             * return View(_etudiant);*/
        }
        public ActionResult ModifierAbsence1()
        {
            int?id = Convert.ToInt32(TempData["idetud"]);



            Repository <Cour>     _repcour   = new Repository <Cour>(AppConfig.DbConnexionString);
            Absenccess            Lnotes     = new Absenccess();
            Repository <Presence> _repradbtn = new Repository <Presence>(AppConfig.DbConnexionString);
            List <Presence>       _etudiant  = _repradbtn.GetAll(v => v.Idetudiant == id && v.IdSemestre == 2, false).ToList();

            Lnotes.ListePresence = _etudiant;
            List <string> cours = new List <string>();

            foreach (Presence e in _etudiant)
            {
                {
                    string cour = _repcour.GetSingle(x => x.IdCour == e.IdCour, false).Libelle;



                    cours.Add(cour);
                }
                ViewBag.IDCour = cours;
            }


            return(View(Lnotes));
        }
        public ActionResult Editsalle(int id)
        {
            Repository <Salle> _repradbtn = new Repository <Salle>(AppConfig.DbConnexionString);
            Salle cour = _repradbtn.GetSingle(v => v.IdSalle == id, false);

            return(View(cour));
        }
        public ActionResult ModifierNote()
        {
            int?id = Convert.ToInt32(TempData["idetud"]);


            int idSemestre               = Convert.ToInt32(Session["Semestre"].ToString());
            Repository <Cour> _repcour   = new Repository <Cour>(AppConfig.DbConnexionString);
            Notess            Lnotes     = new Notess();
            Repository <Note> _repradbtn = new Repository <Note>(AppConfig.DbConnexionString);
            List <Note>       _etudiant  = _repradbtn.GetAll(v => v.Idetudiant == id && v.IdSemestre == 1, false).ToList();

            Lnotes.ListeNote = _etudiant;
            List <string> cours = new List <string>();

            foreach (Note e in _etudiant)
            {
                {
                    string cour = _repcour.GetSingle(x => x.IdCour == e.IdCour, false).Libelle;



                    cours.Add(cour);
                }
                ViewBag.IDCour = cours;
            }


            return(View(Lnotes));
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <ExcutedResult> GetSpeed(Guid id)
        {
            var point = Repository.GetSingle(id);

            if (point == null)
            {
                return(ExcutedResult.FailedResult("", ""));
            }
            try
            {
                var contract   = _contractFactory.GetService <IInfoClient>(point.ChainCode);
                var asynResult = await contract.TestNetSpeed(point.TimeOut, point.HttpAddress);

                var result = asynResult;
                if (result.Status != EnumStatus.Success)
                {
                    point.ErrorCount += 1;
                    Repository.Update(point);
                }
                return(result);
            }
            catch (BusinessException businessException)
            {
                return(ExcutedResult.FailedResult(businessException.ErrorCode, businessException.Message));
            }
        }
Example #6
0
 public CLS_Users GetUserByUsernameAndPassword(string userName, string userPassword)
 {
     try
     {
         return(cmd.GetSingle("SELECT [UserID] ,[UserName] ,[UserPassword] FROM[dbo].[Users]" +
                              " where UserName = @UserName And UserPassword = @UserPassword",
                              new {
             UserName = userName,
             UserPassword = userPassword
         }));
     }
     catch (Exception)
     {
         return(null);
     }
 }
        /// <summary>
        ///     Update admin SPOJ Account
        /// </summary>
        /// <param name="model"></param>
        public void UpdateSpojAccount(AdminSettingSpojAccountUpdateModel model)
        {
            if (model == null || string.IsNullOrEmpty(model.UserName) || string.IsNullOrEmpty(model.Password) || string.IsNullOrEmpty(model.ConfirmPassword))
            {
                throw new SpojDebugException("Invalid model");
            }

            if (model.Password != model.ConfirmPassword)
            {
                throw new SpojDebugException("Invalid Password");
            }

            var setting = Repository.GetSingle();

            if (setting == null)
            {
                setting = new AdminSettingEntity
                {
                    SpojUserNameEncode = DataSecurityUltils.Encrypt(model.UserName, ApplicationConfigs.SpojKey.ForUserName),
                    SpojPasswordEncode = DataSecurityUltils.Encrypt(model.Password, ApplicationConfigs.SpojKey.ForPassword)
                };

                Repository.Insert(setting);

                Repository.SaveChanges();
                return;
            }


            setting.SpojUserNameEncode = DataSecurityUltils.Encrypt(model.UserName, ApplicationConfigs.SpojKey.ForUserName);
            setting.SpojPasswordEncode = DataSecurityUltils.Encrypt(model.Password, ApplicationConfigs.SpojKey.ForPassword);
            Repository.Update(setting, x => x.SpojPasswordEncode, x => x.SpojUserNameEncode);

            Repository.SaveChanges();
        }
        public ActionResult EditBtp(int id)
        {
            Repository <BTP> _repradbtn = new Repository <BTP>(AppConfig.DbConnexionString);
            BTP cour = _repradbtn.GetSingle(v => v.IdBtp == id, false);

            return(View(cour));
        }
Example #9
0
    public string FetchIcon(object component)
    {
        string icon;
        var    type     = component.GetType();
        var    typeName = type.Name;

        if (IconsCache.TryGetValue(typeName, out icon))
        {
            return(icon);
        }

        if (Repository != null)
        {
            var attribute =
                type
                .GetCustomAttributes(typeof(uFrameIdentifier), true)
                .OfType <uFrameIdentifier>()
                .FirstOrDefault();

            if (attribute != null)
            {
                var item = Repository.GetSingle <ComponentNode>(attribute.Identifier);
                if (IconsCache != null && item != null)
                {
                    IconsCache[typeName] = item.CustomIcon;
                }
            }
        }

        IconsCache.TryGetValue(typeName, out icon);
        return(icon);
    }
        public ActionResult Editcour()
        {
            int?id = Convert.ToInt32(TempData["editcour"]);
            Repository <Cour> _repradbtn = new Repository <Cour>(AppConfig.DbConnexionString);
            Cour cour = _repradbtn.GetSingle(v => v.IdCour == id, false);

            return(View(cour));
        }
        public ActionResult EditSpecialite()
        {
            int?id = Convert.ToInt32(TempData["editspec"]);
            Repository <TypeSpecialite> _repradbtn = new Repository <TypeSpecialite>(AppConfig.DbConnexionString);
            TypeSpecialite cour = _repradbtn.GetSingle(v => v.IdSpetialite == id, false);

            return(View(cour));
        }
        public ActionResult EditFormation()
        {
            int?id = Convert.ToInt32(TempData["editformation"]);
            Repository <Formation> _repradbtn = new Repository <Formation>(AppConfig.DbConnexionString);
            Formation cour = _repradbtn.GetSingle(v => v.IdFormation == id, false);

            return(View(cour));
        }
Example #13
0
        /// <summary>
        /// 更新节点信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ExcutedResult UpdateNode(UpdateNodeRequestModel model)
        {
            try
            {
                var user = CurrentUser;
                if (model == null)
                {
                    throw new BusinessException(BusinessResultCode.ArgumentError, "参数错误或无效");
                }
                model.Vefity();
                var node    = Repository.GetSingle(model.Id);
                var oldNode = node;
                if (!String.IsNullOrEmpty(model.Name))
                {
                    node.Name = model.Name;
                }
                if (!String.IsNullOrEmpty(model.HttpAddress))
                {
                    node.HttpAddress = model.HttpAddress;
                }
                node.IsSuper = model.IsSuper;
                if (model.TimeOut == default(int))
                {
                    node.TimeOut = model.TimeOut;
                }
                if (model.Priority == default(int))
                {
                    node.Priority = model.Priority;
                }
                node.QueryAlternative  = model.QueryAlternative;
                node.PlayerAlternative = model.PlayerAlternative;
                node.ServerAlternative = model.ServerAlternative;
                if (!String.IsNullOrEmpty(model.Address))
                {
                    node.Address = model.Address;
                }

                Repository.Update(node);

                OperateLog log = new OperateLog();
                log.Id             = Guid.NewGuid();
                log.ClientIp       = user.ClientIP;
                log.CreateTime     = DateTime.UtcNow;
                log.ManagerAccount = user.Mobile;
                log.ManagerId      = user.Id;
                log.OriginalValue  = JsonConvert.SerializeObject(oldNode);
                log.NewValue       = JsonConvert.SerializeObject(node);
                log.Operate        = "Update";
                log.Function       = "更新节点信息";
                _operateLogRepository.Insert(log);

                return(ExcutedResult.SuccessResult());
            }
            catch (BusinessException businessException)
            {
                return(ExcutedResult.FailedResult(businessException.ErrorCode, businessException.Message));
            }
        }
Example #14
0
        public static List <string> GetNeuralNetworkInputVariables(string neuralNetworkPath)
        {
            var fileName         = "NeuralNetworks.xls";
            var nnFilePath       = Path.Combine(Directory.GetCurrentDirectory(), fileName);
            var connectionString = $"Provider=Microsoft.Jet.OLEDB.4.0; data source={nnFilePath}; Extended Properties=Excel 8.0;";
            var nnRepository     = new Repository <NnModel>(connectionString);
            var model            = nnRepository.GetSingle(neuralNetworkPath);

            return(model.InputNodes.Split(';').ToList());
        }
        public ActionResult AjouterAbsEnseigant()
        {
            int?id = Convert.ToInt32(TempData["absensieg"]);
            Repository <Enseignant> _repensei = new Repository <Enseignant>(AppConfig.DbConnexionString);
            Enseignant _ensei = _repensei.GetSingle(x => x.Idenseignant == id, false);



            return(View("AjouterAbsEnseigant", _ensei));
        }
        public ActionResult GetListEtudiant()
        {
            Repository <Niveau> repeNiv = new Repository <Niveau>(AppConfig.DbConnexionString);

            Repository <Formation> repeformat = new Repository <Formation>(AppConfig.DbConnexionString);

            Repository <TypeSpecialite> repespec = new Repository <TypeSpecialite>(AppConfig.DbConnexionString);



            Repository <Etudiant> repetudiant = new Repository <Etudiant>(AppConfig.DbConnexionString);
            List <Etudiant>       letudiant   = new List <Etudiant>();

            letudiant = repetudiant.GetAll(null, false).ToList();
            List <int>    nive    = new List <int>();
            List <string> forma   = new List <string>();
            List <string> section = new List <string>();

            foreach (Etudiant e in letudiant)
            {
                {
                    int niv = repeNiv.GetSingle(x => x.IdNiveau == e.IdNiveau, false).IdNiveau;

                    if (niv != null)
                    {
                        nive.Add(niv);
                    }
                }
                {
                    string s = repespec.GetSingle(x => x.IdSpetialite == e.IdSpetialite, false).LibelleSpecialite;

                    if (s != null)
                    {
                        section.Add(s);
                    }
                }
                {
                    string f = repeformat.GetSingle(x => x.IdFormation == e.IdFormation, false).LibelleFormation;

                    if (f != null)
                    {
                        forma.Add(f);
                    }
                }
            }


            ViewBag.lista = nive;
            ViewBag.listb = section;
            ViewBag.listc = forma;



            return(View(letudiant));
        }
 private void deleteAssignmentButton_Click(object sender, RoutedEventArgs e)
 {
     using (var context = new TaskBoardDbContext())
     {
         var assignmentsRepository = new Repository <Assignment>(context);
         var assignment            = assignmentsRepository.GetSingle(x => x.Id == Model.Assignment.Id);
         assignmentsRepository.Delete(assignment);
         context.SaveChanges();
     }
     this.Close();
 }
        public ActionResult editEnseignant(int id)
        {
            Repository <Cour> repcour = new Repository <Cour>(AppConfig.DbConnexionString);
            List <Cour>       cour    = repcour.GetAll(null, false).ToList();

            ViewBag.IdCour = new SelectList(cour, "IdCour", "Libelle");

            Repository <Enseignant> _repradbtn = new Repository <Enseignant>(AppConfig.DbConnexionString);
            Enseignant _etudiant = _repradbtn.GetSingle(v => v.Idenseignant == id, false);

            return(View(_etudiant));
        }
Example #19
0
        public IActionResult Create(Model.SourceValue row, string ReturnUrl, int ID)
        {
            row.SourceTypeID = int.Parse(RouteData.Values["id"].ToString());

            var sourcetype = Repository.GetSingle <SourceType>(row.SourceTypeID);

            if (sourcetype.ExpertID != this.Repository.ExpertID)
            {
                throw new Exception("خطا");
            }

            return(this.CreateBase(row, ReturnUrl));
        }
        public ActionResult DeleteConfirmed8()
        {
            int?id = Convert.ToInt32(TempData["idetudelet1"]);
            Repository <Etudiant> _reptoutabs1 = new Repository <Etudiant>(AppConfig.DbConnexionString);


            Etudiant cour = _reptoutabs1.GetSingle(v => v.Idetudiant == id, false);

            _reptoutabs1.Delete(cour);



            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed6(int id)
        {
            int idcou = id;
            Repository <Salle> _reptoutabs1 = new Repository <Salle>(AppConfig.DbConnexionString);


            Salle cour = _reptoutabs1.GetSingle(v => v.IdSalle == idcou, false);

            _reptoutabs1.Delete(cour);



            return(RedirectToAction("Index"));
        }
        /// <summary>
        /// salle
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>


        public ActionResult DetailSalle(int id)
        {
            int idcou = id;

            Repository <Salle> repadmin3 = new Repository <Salle>(AppConfig.DbConnexionString);
            Salle lis1 = repadmin3.GetSingle(v => v.IdSalle == idcou, false);

            if (lis1 == null)
            {
                return(HttpNotFound());
            }

            return(View(lis1));
        }
        public ActionResult DetailsFormation(int id)
        {
            int idcou = id;

            Repository <Formation> repadmin3 = new Repository <Formation>(AppConfig.DbConnexionString);
            Formation lis1 = repadmin3.GetSingle(v => v.IdFormation == idcou, false);

            if (lis1 == null)
            {
                return(HttpNotFound());
            }

            return(View(lis1));
        }
        public ActionResult DeleteConfirmed9(int id)
        {
            int idcou = id;
            Repository <Enseignant> _reptoutabs1 = new Repository <Enseignant>(AppConfig.DbConnexionString);


            Enseignant cour = _reptoutabs1.GetSingle(v => v.Idenseignant == idcou, false);

            _reptoutabs1.Delete(cour);



            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed5()
        {
            int?id = Convert.ToInt32(TempData["deletformation1"]);

            Repository <Formation> _reptoutabs1 = new Repository <Formation>(AppConfig.DbConnexionString);


            Formation cour = _reptoutabs1.GetSingle(v => v.IdFormation == id, false);

            _reptoutabs1.Delete(cour);



            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed2()
        {
            int?id = Convert.ToInt32(TempData["deletspec1"]);

            Repository <TypeSpecialite> _reptoutabs1 = new Repository <TypeSpecialite>(AppConfig.DbConnexionString);


            TypeSpecialite cour = _reptoutabs1.GetSingle(v => v.IdSpetialite == id, false);

            _reptoutabs1.Delete(cour);



            return(RedirectToAction("Index"));
        }
Example #27
0
        /// <summary>
        ///     Returns list of calcualted permissiosn for the user at the given orgId
        /// </summary>
        /// <param name="sessionId">The session identifier.</param>
        /// <param name="orgId">The org identifier.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">User Session is expired</exception>
        public IList <string> GetUserRoles(Guid sessionId, int orgId)
        {
            var user = Repository.GetSingle(u => u.SessionId == sessionId);

            if (user == null)
            {
                throw new Exception(string.Format("User Session Not found. SessionId:{0}", sessionId));
            }
            if (user.Expiration != null && user.Expiration < DateTime.UtcNow)
            {
                throw new Exception("User Session is expired");
            }

            return(Repository.GetUserRoles(user.UserId, orgId));
        }
        public ActionResult DeleteSalle(int id, bool?saveChangesError)
        {
            Repository <Salle> _reptoutabs1 = new Repository <Salle>(AppConfig.DbConnexionString);

            int idcou = id;


            if (saveChangesError.GetValueOrDefault())
            {
                ViewBag.ErrorMessage = "Unable to save changes. Try again, and if the problem persists see your system administrator.";
            }
            Salle cour = _reptoutabs1.GetSingle(v => v.IdSalle == idcou, false);

            return(View(cour));
        }
 public CLS_Category GetCategoryID(string categoryName)
 {
     try
     {
         return(cmd.GetSingle(SP_Category.getStoredProceger("SP_GetCategoryId"),
                              new CLS_Category
         {
             CategoryName = categoryName
         }));
     }
     catch (Exception)
     {
         return(null);
     }
 }
        public ActionResult DeleteEtudiant(bool?saveChangesError)
        {
            int?id = Convert.ToInt32(TempData["idetudelet"]);
            Repository <Etudiant> _reptoutabs1 = new Repository <Etudiant>(AppConfig.DbConnexionString);



            if (saveChangesError.GetValueOrDefault())
            {
                ViewBag.ErrorMessage = "Unable to save changes. Try again, and if the problem persists see your system administrator.";
            }
            Etudiant cour = _reptoutabs1.GetSingle(v => v.Idetudiant == id, false);

            TempData["idetudelet1"] = id;
            return(View(cour));
        }
Example #31
0
 public 仓库EditModel 仓库信息_GetEditModelById(string 仓库信息编码)
 {
     using (var context = new BDKRContext())
     {
         var r = new Repository<仓库信息>(context);
         var e = r.GetSingle(t => t.编码 == 仓库信息编码);
         if (null != e)
             return e.ConvertToEditModel();
         return null;
     }
 }
Example #32
0
 public int 仓库信息_Delete(string 仓库信息编码)
 {
     using (var context = new BDKRContext())
     {
         var r = new Repository<仓库信息>(context);
         var e = r.GetSingle(t => t.编码 == 仓库信息编码);
         if (null == e)
             throw new Exception("仓库信息并不存在");
         if (e.实时库存明细List != null && e.实时库存明细List.Count > 0)
             throw new Exception("实时库存中含有此仓库信息,无法删除!");
         if (e.采购进货单明细List != null && e.采购进货单明细List.Count > 0)
             throw new Exception("采购进货单明细中含有此仓库信息,无法删除!");
         return r.Remove(e);
     }
 }
Example #33
0
 public int 仓库信息_Update(仓库EditModel model)
 {
     using (var context = new BDKRContext())
     {
         var r = new Repository<仓库信息>(context);
         var e = r.GetSingle(t => t.编码 == model.编码);
         if (null == e)
             throw new Exception("该仓库信息并不存在");
         e.仓库名称 = model.仓库名称;
         e.仓库类别编码 = model.类别编码;
         e.制品缓冲库 = model.制品缓冲库;
         //e.门店信息编码 = model.门店编码;
         e.附件说明 = model.附加说明;
         return r.Edit(e);
     }
 }
Example #34
0
 public void 员工信息_Update(员工信息EditModel model)
 {
     using (var context = new BDKRContext())
     {
         var r = new Repository<员工信息>(context);
         var e = r.GetSingle(t => t.编码 == model.编码);
         if (null == e)
             throw new Exception("员工信息并不存在");
         if (e.姓名 != model.员工姓名)
             e.拼音 = UtilHelper.PinYin(model.员工姓名);
         e.姓名 = model.员工姓名;
         e.入职日期 = model.入职日期;
         e.工号 = model.工号;
         e.当前基本工资 = model.当前基本工资;
         e.职位 = model.职位;
         e.联系电话 = model.联系电话;
         e.身份证号 = model.身份证号;
         e.门店编码 = model.门店编码;
         e.附加说明 = model.附加说明;
         r.Edit(e, t => t.编码 == model.编码);
     }
 }
Example #35
0
 public void 员工信息_Delete(string 员工信息编码)
 {
     using (var context = new BDKRContext())
     {
         var r = new Repository<员工信息>(context);
         var e = r.GetSingle(t => t.编码 == 员工信息编码);
         if (null == e)
             throw new Exception("该员工信息不存在");
         r.Remove(e, t => t.编码 == 员工信息编码);
     }
 }
Example #36
0
 public int 货品信息_Delete(string 货品信息编码)
 {
     using (var context = new BDKRContext())
     {
         var r = new Repository<货品信息>(context);
         var e = r.GetSingle(t => t.编码 == 货品信息编码);
         if (null == e)
             throw new Exception("货品信息并不存在");
         if (e.实时库存List != null && e.实时库存List.Count > 0)
             throw new Exception("实时库存存在此货品信息");
         if (e.货品BOMList != null && e.货品BOMList.Count > 0)
             throw new Exception("货品BOM中存在此货品信息");
         if (e.采购进货单明细List != null && e.采购进货单明细List.Count > 0)
             throw new Exception("采购进货单明细中存在此货品信息");
         return r.Remove(e, t => t.编码 == 货品信息编码);
     }
 }
Example #37
0
 public int 货品类别_Delete(string 货品类别编码)
 {
     using (var context = new BDKRContext())
     {
         var r = new Repository<货品类别>(context);
         var e = r.GetSingle(t => t.编码 == 货品类别编码);
         if (null == e)
             throw new Exception("该类别信息并不存在");
         return r.Remove(e, t => t.编码 == 货品类别编码);
     }
 }
Example #38
0
 public void 门店信息_Update(门店EditModel model)
 {
     using (var context = new BDKRContext())
     {
         var r = new Repository<门店信息>(context);
         var e = r.GetSingle(t => t.编码 == model.编码);
         if (null == e)
             throw new Exception("门店信息并不存在");
         r.Edit(e, t => t.编码 == model.编码);
     }
 }
Example #39
0
 public int 门店信息_Delete(string 门店编码)
 {
     using (var context = new BDKRContext())
     {
         var r = new Repository<门店信息>(context);
         var e = r.GetSingle(t => t.编码 == 门店编码);
         if (null == e)
             throw new Exception("门店信息并不存在");
         if (e.仓库信息List != null && e.仓库信息List.Count > 0)
             throw new Exception("门店所属仓库信息存在");
         if (e.员工信息List != null && e.员工信息List.Count > 0)
             throw new Exception("门店所属员工信息存在");
         if (e.实时库存明细List != null && e.实时库存明细List.Count > 0)
             throw new Exception("门店所属实时库存信息存在");
         if (e.收支费用流水清单List != null && e.收支费用流水清单List.Count > 0)
             throw new Exception("门店所属收支费用明细表存在");
         if (e.日常费用明细表List != null && e.日常费用明细表List.Count > 0)
             throw new Exception("门店所属日常费用明细表存在");
         if (e.菜品销售单List != null && e.菜品销售单List.Count > 0)
             throw new Exception("门店所属菜品销售单存在");
         if (e.费用汇总表List != null && e.费用汇总表List.Count > 0)
             throw new Exception("门店所属费用汇总表存在");
         if (e.采购进货单List != null && e.采购进货单List.Count > 0)
             throw new Exception("门店所属采购进货单存在");
         if (e.餐厅损益表List != null && e.餐厅损益表List.Count > 0)
             throw new Exception("门店所属餐厅损益表存在");
         return r.Remove(e, t => t.编码 == 门店编码);
     }
 }
Example #40
0
 public int 货品类别_Update(货品类别EditModel model)
 {
     using (var context = new BDKRContext())
     {
         var r = new Repository<货品类别>(context);
         var e = r.GetSingle(t => t.编码 == model.编码);
         if (null == e)
             throw new Exception("该类别信息并不存在");
         return r.Edit(e, t => t.编码 == model.编码);
     }
 }
Example #41
0
 public int 菜品信息_AddNew(菜品信息EditModel model)
 {
     int _count = 0;
     using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
     {
         using (var context = new BDKRContext())
         {
             var r = new Repository<货品信息>(context);
             var e = r.GetSingle(t => t.编码 == model.编码);
             if (null != e)
                 throw new Exception("菜品信息当前已存在");
             e = new 货品信息
             {
                 单位 = model.单位,
                 名称 = model.菜品名称,
                 备注 = model.附加说明,
                 拼音 = UtilHelper.PinYin(model.菜品名称),
                 是否菜品 = true,
                 编码 = model.编码,
                 规格 = model.规格,
                 货品类别编码 = model.菜品类别
             };
             if (model.当前销售价格 > 0)
             {
                 var cj = new 销售价格表
                 {
                     价格 = model.当前销售价格,
                     创建时间 = DateTime.Now,
                     编码 = 销售价格_GetNewCode(),
                     货品信息编码 = model.编码,
                     附加说明 = ""
                 };
                 var _jg = new Repository<销售价格表>(context);
                 _jg.AddNew(cj);
             }
             _count = r.AddNew(e);
             if (model.Details != null && model.Details.Count > 0)
             {
                 var _bcode = 货品BOM_GetNewCode();
             }
         }
         ts.Complete();
     }
     return _count;
 }