Пример #1
0
        public string Get_Available(int slotid, string dat)
        {
            DateTime dt1 = BaseUtil.GetCurrentDateTime();

            if (dat.ToString() != "")
            {
                dt1 = Convert.ToDateTime(dat.ToString()).Date;
            }
            var             dt               = dt1.Date;
            string          result           = "no";
            slotTempBlocked oslotTempBlocked = new slotTempBlocked();
            long            companyID        = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.companyID.ToString()));
            long            employerID       = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.employerID.ToString()));

            oslotTempBlocked = db.slotTempBlockeds.Where(e => e.SlotID == slotid && e.companyID == companyID && e.forDate == dt).FirstOrDefault();

            oslotTempBlocked.isDeleted     = true;
            oslotTempBlocked.modifyBy      = employerID;
            oslotTempBlocked.dataIsUpdated = BaseUtil.GetCurrentDateTime();
            try
            {
                db.Entry(oslotTempBlocked).State = EntityState.Modified;
                db.SaveChanges();
                result = "OK";
                return(result);
            }
            catch (Exception ex)
            {
                BaseUtil.CaptureErrorValues(ex);
                return(result);
            }
        }
Пример #2
0
        public ActionResult tempBlockSlots(FormCollection frm)
        {
            string          items = frm["mySkillsValues"].ToString();
            slotTempBlocked oslotTempBlocked;

            string[] i1;
            if (items != null)
            {
                i1 = items.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < i1.Length; i++)
                {
                    string slotID = i1[i]; /*Inside string type s variable should contain items values */
                    oslotTempBlocked               = new slotTempBlocked();
                    oslotTempBlocked.companyID     = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.companyID.ToString()));
                    oslotTempBlocked.EmployerID    = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.employerID.ToString()));
                    oslotTempBlocked.SlotID        = Convert.ToInt32(slotID);
                    oslotTempBlocked.modifyBy      = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.employerID.ToString()));
                    oslotTempBlocked.isDeleted     = false;
                    oslotTempBlocked.forDate       = Convert.ToDateTime(frm["sdate"]);
                    oslotTempBlocked.dataIsUpdated = BaseUtil.GetCurrentDateTime();
                    oslotTempBlocked.dataIsCreated = BaseUtil.GetCurrentDateTime();
                    db.slotTempBlockeds.Add(oslotTempBlocked);
                    try
                    {
                        db.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        TempData["msg"] = ex.Message.ToString();
                        BaseUtil.CaptureErrorValues(ex);
                        return(RedirectToAction("Error"));
                    }
                }
            }


            return(View());
        }