Exemplo n.º 1
0
 public ActionResult Update(T_CMS_Master_Contract model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             // TODO: Add insert logic here
             T_CMS_Master_ContractManager.Update(model);
             //return RedirectToAction("Index");
         }
         return(View(model));
     }
     catch
     {
         return(View(model));
     }
 }
Exemplo n.º 2
0
        public ContentResult T_CMS_Master_ContractEvt(int[] ID, string Action)
        {
            // You have your books IDs on the deleteInputs array
            JsonObject obj = new JsonObject();

            switch (Action.ToLower())
            {
            case "delete":

                if (ID != null && ID.Length > 0)
                {
                    int length = ID.Length;
                    T_CMS_Master_Contract objItem;
                    for (int i = 0; i <= length - 1; i++)
                    {
                        objItem = T_CMS_Master_ContractManager.GetById(ID[i]);
                        if (objItem != null)
                        {
                            T_CMS_Master_ContractManager.Delete(objItem);
                        }
                    }
                }
                break;

            case "print":

                if (ID != null && ID.Length > 0)
                {
                    int length = ID.Length;
                    ContractReportCollection objList = new ContractReportCollection();
                    T_CMS_Master_Contract    objItem;
                    ContractReport           objReportItem;

                    for (int i = 0; i <= length - 1; i++)
                    {
                        objItem = T_CMS_Master_ContractManager.GetById(ID[i]);
                        if (objItem.ID != 0)
                        {
                            objItem.StatusID = 3;
                            //objItem.IsActive = true;
                            objItem.ModifiedDate = SystemConfig.CurrentDate;
                            T_CMS_Master_ContractManager.Update(objItem);
                            objReportItem = new ContractReport()
                            {
                                ID           = CommonHelper.EncyptURLString(objItem.ID.ToString()),
                                EntityId     = CommonHelper.EncyptURLString(objItem.CMSOrg.Entity_Id.ToString()),
                                EmployeeCode = CommonHelper.EncyptURLString(objItem.EmployeeCode.ToString()),
                                filepath     = CommonHelper.EncyptURLString("Templates\\Rpt_Contract_RBVH.rdlc"),
                                Mode         = CommonHelper.EncyptURLString("CONTRACT"),
                                filetype     = "PDF"
                            };
                            //objItem.ID = CommonHelper.EncyptURLString(objItem.ID);

                            objList.Add(objReportItem);
                        }
                    }
                    obj.Data = objList;
                }
                break;
            }

            return(Content(JsonConvert.SerializeObject(obj), "application/json"));
        }
Exemplo n.º 3
0
        public ActionResult Create(T_CMS_Master_Contract model)
        {
            try
            {
                //  ModelState.Remove("dateEffetPosition");
                if (ModelState.IsValid)
                {
                    //model.CompanyID= CurrentUser.CompanyID;
                    // model.CompanyID = CurrentUser.CompanyID;
                    // model.CreatedUser = CurrentUser.UserName;
                    if (model.ID != 0)
                    {
                        //get default value
                        T_CMS_Master_Contract          b = T_CMS_Master_ContractManager.GetById(model.ID);
                        T_CMS_Master_EmploymentType    objEmpType;
                        T_CMS_Master_EmploymentSubType objEmpSubType;
                        T_COm_Master_Org objOrg;
                        b.ModifiedDate = SystemConfig.CurrentDate;

                        b.FirstName_EN  = model.FirstName_EN.ToUpper();
                        b.LastName_EN   = model.LastName_EN.ToUpper();
                        b.MiddleName_EN = model.MiddleName_EN.ToUpper();
                        b.FirstName_VN  = model.FirstName_VN.ToUpper();
                        b.LastName_VN   = model.LastName_VN.ToUpper();
                        b.MiddleName_VN = model.MiddleName_VN.ToUpper();

                        b.IDCardNo      = model.IDCardNo;
                        b.IDPOI         = model.IDPOI;
                        b.DOB           = model.DOB;
                        b.PassportNo    = model.PassportNo;
                        b.PassportPOI   = model.PassportPOI;
                        b.LabourDOI     = model.LabourDOI;
                        b.PerAddress    = model.PerAddress;
                        b.IDDOI         = model.IDDOI;
                        b.HighestDegree = model.HighestDegree;
                        b.POB           = model.POB;
                        b.PassportDOI   = model.PassportDOI;
                        b.LabourBookNo  = model.LabourBookNo;
                        b.LabourPOI     = model.LabourPOI;
                        b.Remarks       = model.Remarks;


                        b.DeptID       = model.DeptID;
                        b.LocationID   = model.LocationID;
                        b.ContractTerm = model.ContractTerm;
                        b.PositionID   = model.PositionID;
                        b.AnnualLeave  = model.AnnualLeave;
                        b.WorkHoursID  = model.WorkHoursID;

                        //duoble check to get AnuualLeave
                        b.GradeID      = model.GradeID;
                        b.AnnualLeave  = model.AnnualLeave;
                        b.ContractTerm = model.ContractTerm;
                        b.EmpSubTypeID = model.EmpSubTypeID;
                        b.SalutationID = model.SalutationID;

                        objOrg = T_COm_Master_OrgManager.GetById(model.DeptID);
                        if (objOrg != null)
                        {
                            objEmpType    = T_CMS_Master_EmploymentTypeManager.GetAllByEntityID(objOrg.Entity_Id, "C");
                            objEmpSubType = T_CMS_Master_EmploymentSubTypeManager.GetById(objEmpType.EmpTypeID);
                        }
                        int ProbationID = 0;

                        if (model.ContractTerm == 0)
                        {
                            //b.EmpSubTypeID = 101;//seasonable Sub-Type
                            b.ProbationsPeriod = 0;
                        }
                        else
                        {
                            b.ProbationsPeriod = model.ContractTerm / 12;
                        }
                        //else if (model.ContractTerm < 12)
                        //{
                        //  //  b.EmpSubTypeID = 103;//seasonable Sub-Type
                        //    b.ProbationsPeriod = null;
                        //}
                        //else
                        //{
                        //    //b.EmpSubTypeID = 102;//seasonable Sub-Type
                        //    b.ProbationsPeriod = 2;
                        //}


                        b.Grossoffer = model.Grossoffer;
                        //model.CreatedDate = b.CreatedDate;
                        //  model.CreatedUser = b.CreatedUser;
                        b.Joiningdate  = model.Joiningdate;
                        b.Enddate      = model.Enddate;
                        b.ModifiedBy   = CurrentUser.EmployeeCode;
                        b.OriginalDate = SystemConfig.CurrentDate;

                        ///set default value only
                        b.HomeGrossOfferEffectiveFrom = SystemConfig.CurrentDate;
                        b.HostGrossOfferEffectiveFrom = SystemConfig.CurrentDate;
                        b.HomeGrossOfferEffectiveTo   = SystemConfig.CurrentDate;
                        b.HostGrossOfferEffectiveTo   = SystemConfig.CurrentDate;
                        b.WorkPermitTo   = model.Enddate;
                        b.OriginalDate   = SystemConfig.CurrentDate;
                        b.WorkPermitFrom = SystemConfig.CurrentDate;

                        //if (model.LabourDOI.ToString().IndexOf("01/01/0001") == -1)
                        //{
                        //    b.LabourDOI =null;
                        //}
                        //if (model.PassportDOI.ToString().IndexOf("01/01/0001") == -1)
                        //{
                        //    model.PassportDOI = null;
                        //}
                        T_CMS_Master_ContractManager.Update(b);
                    }
                    else
                    {
                        // TODO: Add insert logic here
                        model.CreatedDate = SystemConfig.CurrentDate;
                        T_CMS_Master_ContractManager.Add(model);
                    }
                    return(View(ViewFolder + "list.cshtml"));
                }
            }
            catch
            {
                return(View(ViewFolder + "Create.cshtml", model));
            }
            return(View(ViewFolder + "Create.cshtml", model));
        }