Example #1
0
        /// <summary>
        /// Ensures that an object with the specified name exists, while creating other properties are set to their default values
        /// </summary>
        /// <param name="i_sName">Name</param>
        /// <returns>cFile object</returns>
        public static cFile CreateIfRequiredAndGet(string i_sName)
        {
            cFile oObj = cFile.Get_Name(i_sName);

            if (oObj == null)
            {
                oObj       = cFile.Create();
                oObj.sName = i_sName;
                oObj.Save();
            }
            return(oObj);
        }
        public ActionResult DevelopmentPlan(List <HttpPostedFileBase> file)
        {
            try
            {
                int loginID = Convert.ToInt32(HttpContext.User.Identity.Name);
                //FIle Upload:-

                if (file.Count > 0)
                {
                    foreach (var item in file)
                    {
                        if (item != null)
                        {
                            cFile  objfile  = cFile.Create();
                            string filename = Path.GetFileNameWithoutExtension(item.FileName) + DateTime.Now.ToString().Replace('/', '_').Replace(':', '_') + Path.GetExtension(item.FileName);
                            item.SaveAs((FilePath + filename));
                            objfile.sFileName             = filename;
                            objfile.objEmpLogin.iObjectID = loginID;
                            objfile.objCareerDevelopmentPlan.iObjectID = 0;
                            objfile.Save();
                        }
                    }
                }

                string      DevopmentPlan = Request.QueryString["DevelopmentPlan"];
                List <Data> list          = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Data> >(DevopmentPlan);
                int         LoginId       = Convert.ToInt32(HttpContext.User.Identity.Name);
                for (var i = 0; i < list.Count; i++)
                {
                    cCareerDevelopmentPlan objDevPlan = cCareerDevelopmentPlan.Create();

                    objDevPlan.sDevGoalName          = list[i].GoalName;
                    objDevPlan.sActionRequired       = list[i].Action;
                    objDevPlan.sTracking             = list[i].Tracking;
                    objDevPlan.sManagerComment       = list[i].ManagerComment;
                    objDevPlan.objStatus.iObjectID   = list[i].StatusList;
                    objDevPlan.objEmpLogin.iObjectID = LoginId;
                    objDevPlan.Save();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(RedirectToAction("DevelopmentGoals", "QuadrantMeasures"));
            //return View(objQuadrantMeasure);
        }