public ActionResult T_CMS_Master_SalutationEvt(int[] SalutationID, string Action)
        {
            // You have your books IDs on the deleteInputs array
            switch (Action.ToLower())
            {
            case "delete":

                if (SalutationID != null && SalutationID.Length > 0)
                {
                    int length = SalutationID.Length;
                    T_CMS_Master_Salutation objItem;
                    for (int i = 0; i <= length - 1; i++)
                    {
                        objItem = T_CMS_Master_SalutationManager.GetById(SalutationID[i]);
                        if (objItem != null)
                        {
                            T_CMS_Master_SalutationManager.Delete(objItem);
                        }
                    }
                    return(View(ViewFolder + "list.cshtml", T_CMS_Master_SalutationManager.GetAll()));
                }
                break;
            }


            return(View("PostFrm"));
        }
 public ActionResult Create(T_CMS_Master_Salutation model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             // model.CreatedUser = CurrentUser.UserName;
             if (model.SalutationID != 0)
             {
                 //get default value
                 //	T_CMS_Master_Salutation b = T_CMS_Master_SalutationManager.GetById(model.SalutationID);
                 T_CMS_Master_SalutationManager.Update(model);
             }
             else
             {
                 // TODO: Add insert logic here
                 model.CreatedDate = SystemConfig.CurrentDate;
                 T_CMS_Master_SalutationManager.Add(model);
             }
             return(View(ViewFolder + "list.cshtml", T_CMS_Master_SalutationManager.GetAll()));
         }
     }
     catch
     {
         return(View(model));
     }
     return(View(model));
 }
        public ContentResult Save(string objdata, string value)
        {
            JsonObject js = new JsonObject();

            js.StatusCode = 200;
            js.Message    = "Upload Success";
            try
            {
                T_CMS_Master_Salutation obj = JsonConvert.DeserializeObject <T_CMS_Master_Salutation>(objdata);
                obj = T_CMS_Master_SalutationManager.Update(obj);
                if (obj.SalutationID == 0)
                {
                    js.StatusCode = 400;
                    js.Message    = "Has Errors. Please contact Admin for more information";
                }
                else
                {
                    js.Data = obj;
                }
            }
            catch (Exception objEx)
            {
                js.StatusCode = 400;
                js.Message    = objEx.Message;
            }

            return(Content(JsonConvert.SerializeObject(js), "application/json"));
        }
        /// <summary>
        /// use for setting up default value
        /// </summary>
        /// <returns></returns>
        public ActionResult Update(int SalutationID, string TargetID = "T_CMS_Master_Salutationlist")
        {
            T_CMS_Master_Salutation objItem = T_CMS_Master_SalutationManager.GetById(SalutationID);

            objItem.TargetDisplayID = TargetID;
            return(View(ViewFolder + "Create.cshtml", objItem));
        }
        public ContentResult Search(SearchFilter SearchKey)
        {
            SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "SalutationID" : SearchKey.OrderBy;
            T_CMS_Master_SalutationCollection collection = T_CMS_Master_SalutationManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(collection), "application/json"));
        }
        /// <summary>
        /// use for scrolling page
        /// </summary>
        /// <returns></returns>
        public ContentResult GetPg(int page, int pagesize)
        {
            string       condition = "";
            SearchFilter SearchKey = SearchFilter.SearchPG(1, page, pagesize, "SalutationID", "SalutationID", "Desc", condition);
            T_CMS_Master_SalutationCollection objItem = T_CMS_Master_SalutationManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(objItem), "application/json"));
        }
        public JsonResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            SearchFilter SearchKey = SearchFilter.SearchData(1, requestModel, "SalutationID", "SalutationID");
            T_CMS_Master_SalutationCollection collection = T_CMS_Master_SalutationManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet));
        }
 public ActionResult Update(T_CMS_Master_Salutation model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             // TODO: Add insert logic here
             T_CMS_Master_SalutationManager.Update(model);
             //return RedirectToAction("Index");
         }
         return(View(model));
     }
     catch
     {
         return(View(model));
     }
 }
        /// <summary>
        /// ExportExcel File
        /// </summary>
        /// <returns></returns>
        public string ExportExcel()
        {
            T_CMS_Master_SalutationCollection collection = T_CMS_Master_SalutationManager.GetAll();
            DataTable dt       = collection.ToDataTable <T_CMS_Master_Salutation>();
            string    fileName = "T_CMS_Master_Salutation_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy");

            string[] RemoveColumn = { "CompanyID", "TargetDisplayID", "ReturnDisplay", "TotalRecord", "CreatedUser", "CreatedDate" };
            for (int i = 0; i < RemoveColumn.Length; i++)
            {
                if (dt.Columns.Contains(RemoveColumn[i]))
                {
                    dt.Columns.Remove(RemoveColumn[i]);
                }
            }
            FileInputHelper.ExportExcel(dt, fileName, "T_CMS_Master_Salutation List", false);
            return(fileName);
        }
        public ContentResult SaveExcel(string item)
        {
            //string b = Request["item"];
            IEnumerable <T_CMS_Master_Salutation> objItemList = JsonConvert.DeserializeObject <IEnumerable <T_CMS_Master_Salutation> >(item);

            JsonObject obj = new JsonObject();

            obj.StatusCode = 200;
            obj.Message    = "The process is sucessed";
            foreach (T_CMS_Master_Salutation objitem in objItemList)
            {
                //default value
                //objitem.CreatedUser = CurrentUser.UserName;
                objitem.CreatedDate = SystemConfig.CurrentDate;

                T_CMS_Master_SalutationManager.Add(objitem);
            }

            return(Content(JsonConvert.SerializeObject(obj), "application/json"));
        }
 // PUT api/<controller>/5
 /// <summary>
 /// Puts the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 /// <exception cref="HttpResponseException"></exception>
 public T_CMS_Master_Salutation Put(string id, [FromBody] T_CMS_Master_Salutation value)
 {
     return(T_CMS_Master_SalutationManager.UpdateItem(value));
 }
 // POST api/<controller>
 /// <summary>
 /// Posts the specified value.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public T_CMS_Master_Salutation Post([FromBody] T_CMS_Master_Salutation value)
 {
     return(T_CMS_Master_SalutationManager.AddItem(value));
 }
 // GET api/<controller>/5
 /// <summary>
 /// Gets the specified COM group identifier.
 /// </summary>
 /// <param name="T_CMS_Master_SalutationId">The COM group identifier.</param>
 /// <returns></returns>
 public T_CMS_Master_Salutation Get(int SalutationID)
 {
     return(T_CMS_Master_SalutationManager.GetItemByID(SalutationID));
 }
 public T_CMS_Master_SalutationCollection GetbyUser(string usr)
 {
     return(T_CMS_Master_SalutationManager.GetbyUser(usr));
 }
 // GET api/<controller>
 /// <summary>
 /// Gets this instance.
 /// </summary>
 /// <returns></returns>
 public T_CMS_Master_SalutationCollection Get()
 {
     return(T_CMS_Master_SalutationManager.GetAllItem());
 }
        public ActionResult Get(int SalutationID, string action)
        {
            T_CMS_Master_Salutation objItem = T_CMS_Master_SalutationManager.GetById(SalutationID);

            return(Content(JsonConvert.SerializeObject(objItem), "application/json"));
        }
        public ActionResult Get(int SalutationID)
        {
            T_CMS_Master_Salutation objItem = T_CMS_Master_SalutationManager.GetById(SalutationID);

            return(View(objItem));
        }
 // GET api/<controller>
 /// <summary>
 /// Gets this instance.
 /// </summary>
 /// <returns></returns>
 public T_CMS_Master_SalutationCollection Post(string method, [FromBody] SearchFilter value)
 {
     return(T_CMS_Master_SalutationManager.Search(value));
 }
        public ActionResult list()
        {
            T_CMS_Master_SalutationCollection collection = T_CMS_Master_SalutationManager.GetAll();

            return(View(ViewFolder + "list.cshtml", collection));
        }
 // DELETE api/<controller>/5
 /// <summary>
 /// Deletes the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 public void Delete(int id)
 {
     T_CMS_Master_SalutationManager.DeleteItem(id);
 }
Пример #21
0
        public void ExportExcel(string searchprm)
        {
            DataSet   ds = new DataSet();
            DataTable mydata;
            int       RBVH = 10001;
            //T_CMS_Master_ContractCollection collection = T_CMS_Master_ContractManager.GetAll(false);
            SearchFilter mySearch = BindSearch(searchprm);

            T_CMS_Master_ContractCollection collection = T_CMS_Master_ContractManager.Search(mySearch);

            mydata = collection.ToDataTable <T_CMS_Master_Contract>();
            string fileName = "Contract_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy");

            string[] RemoveColumn = { "CompanyID",                   "TargetDisplayID",             "ReturnDisplay",            "TotalRecord",
                                      "CreatedUser",                 "CreatedDate",                 "StatusID",                 "ApproverLevel",   "ContractLevel",        "SalutationID", "PositionID",  "LocationID",
                                      "PassportNo",                  "PassportDOI",                 "PassportPOI",              "LabourBookNo",    "LabourDOI",
                                      "LabourPOI",                   "AnnualLeave",                 "EmpTypeID",
                                      "EmpSubTypeID",                "WorkPermitNo",                "WorkPermitFrom",           "WorkPermitTo",
                                      "HomeGrossOffer",              "HomeGrossOfferEffectiveFrom",
                                      "HomeGrossOfferEffectiveTo",   "RelocationallowanceCurrency", "Relocationallowance",
                                      "GoabroadallowanceCurrency",   "Goabroadallowance",           "WaivingallowanceCurrency", "Waivingallowance","HostCountryCurrency",
                                      "HostGrossOfferEffectiveFrom", "HostGrossOfferEffectiveTo",   "Remarks",                  "CreatedBy",       "ModifiedBy",
                                      "ModifiedDate",                "IsActive",                    "OriginalDate",             "WorkFlowStatus",  "HandPhone",            "TempAddress",  "WorkHoursID", "ContractTerm","ProbationsPeriod","IDPOI", "Fullname",
                                      //"FirstName_EN","MiddleName_EN","LastName_EN","ContractNo","EmployeeCode",
                                      "GradeID",                     "CMSOrg",                      "Mode",                     "DeptID",          "ErrorMesssage" };
            for (int i = 0; i < RemoveColumn.Length; i++)
            {
                if (mydata.Columns.Contains(RemoveColumn[i]))
                {
                    mydata.Columns.Remove(RemoveColumn[i]);
                }
            }
            ds.Tables.Add(mydata);

            //DNH Position
            T_COM_Master_PositionCollection deColection = T_COM_Master_PositionManager.GetAll();

            mydata = deColection.ToDataTable <T_COM_Master_Position>();
            ds.Tables.Add(mydata);

            //DNH Grade
            T_COM_Master_GradeCollection objGrades = T_COM_Master_GradeManager.GetAll();

            mydata = objGrades.ToDataTable <T_COM_Master_Grade>();
            ds.Tables.Add(mydata);

            //DN Saluation

            T_CMS_Master_SalutationCollection objSalutation = T_CMS_Master_SalutationManager.GetAll();

            mydata = objSalutation.ToDataTable <T_CMS_Master_Salutation>();
            ds.Tables.Add(mydata);

            //DN Working Hours
            T_CMS_Master_WorkHoursCollection objWK = T_CMS_Master_WorkHoursManager.GetAll();

            //T_CMS_InterfaceLacviet_WorkingHoursCollection objWK = T_CMS_InterfaceLacviet_WorkingHoursManager.GetAll();
            mydata = objWK.ToDataTable <T_CMS_Master_WorkHours>();
            ds.Tables.Add(mydata);

            //DN Working Contract Term
            T_CMS_Static_ContractTermCollection objCT = T_CMS_Static_ContractTermManager.GetAll();

            mydata = objCT.ToDataTable <T_CMS_Static_ContractTerm>();
            ds.Tables.Add(mydata);

            //DN Working Probation
            T_CMS_Static_PeriodOfProbationCollection objPr = T_CMS_Static_PeriodOfProbationManager.GetAll();

            objPr.Add(new T_CMS_Static_PeriodOfProbation()
            {
                ID     = 100,
                Period = 0,
            });
            mydata = objPr.ToDataTable <T_CMS_Static_PeriodOfProbation>();
            ds.Tables.Add(mydata);

            //DN  Degree
            T_COM_Master_DegreeCollection objDg = T_COM_Master_DegreeManager.GetAll();

            mydata = objDg.ToDataTable <T_COM_Master_Degree>();
            ds.Tables.Add(mydata);

            //DN Working Location
            T_COM_Master_LocationCollection objLocation = T_COM_Master_LocationManager.GetAllByEntityID(RBVH);

            mydata = objLocation.ToDataTable <T_COM_Master_Location>();
            ds.Tables.Add(mydata);

            //DN Place of Issues
            T_COM_Master_PlaceOfIssueCollection objPOI = T_COM_Master_PlaceOfIssueManager.GetAll();

            mydata = objPOI.ToDataTable <T_COM_Master_PlaceOfIssue>();
            ds.Tables.Add(mydata);

            //DN Place of Issues
            T_COm_Master_OrgCollection objDepartment = T_COm_Master_OrgManager.GetAll();

            mydata = objDepartment.ToDataTable <T_COm_Master_Org>();
            ds.Tables.Add(mydata);

            // ds.Tables.Add(dt2);
            //ds.Tables.Add(dt3);
            List <string> groupCodeList = new List <string>();

            string[] sheetName = { "Contract", "Position", "Grade", "Saluation", "Working Hours", "Contract Term", "Probation", "Degree", "Location", "Place Of Issue", "Department" };
            List <DropdownModelExcel> listDrop = new List <DropdownModelExcel>()
            {
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 11,
                    ColumnShowDropData  = 2,
                    RangeSheetData      = "B2:B" + (objDepartment.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 4,
                    ColumnShowDropData  = 3,
                    RangeSheetData      = "B2:B" + (objSalutation.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 3,
                    ColumnShowDropData  = 10,
                    RangeSheetData      = "B2:B" + (objGrades.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 2,
                    ColumnShowDropData  = 11, //column 12
                    RangeSheetData      = "B2:B" + (deColection.Count + 1),
                    IsHideSheetDataDrop = true
                },//location
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 9,
                    ColumnShowDropData  = 16, //column 16 -Location
                    RangeSheetData      = "B2:B" + (objLocation.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 5,
                    ColumnShowDropData  = 17, //column 16
                    RangeSheetData      = "B2:B" + (objWK.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 6,
                    ColumnShowDropData  = 18, //column 16
                    RangeSheetData      = "B2:B" + (objCT.Count + 1),
                    IsHideSheetDataDrop = true
                },
                //propration Period
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 7,
                    ColumnShowDropData  = 19, //column 16
                    RangeSheetData      = "B2:B" + (objPr.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 8,
                    ColumnShowDropData  = 25, //column 16
                    RangeSheetData      = "B2:B" + (objDg.Count + 1),
                    IsHideSheetDataDrop = true
                },
                //ID Place of Birth
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 10,
                    ColumnShowDropData  = 21, //column 16
                    RangeSheetData      = "D2:D" + (objPOI.Count + 1),
                    IsHideSheetDataDrop = true
                },
                //ID Place of issues
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 10,
                    ColumnShowDropData  = 24, //column 16
                    RangeSheetData      = "B2:B" + (objPOI.Count + 1),
                    IsHideSheetDataDrop = true
                },
            };

            //set Column Date Format
            int[]     DateColumn = { 14, 15, 20, 23 };
            ExcelPara mypara     = new ExcelPara()
            {
                ds          = ds,
                sheetName   = sheetName,
                fileName    = fileName,
                list        = listDrop,
                DateColumns = DateColumn,
                DateFormat  = "dd-mmm-yyyy"
            };

            //FileInputHelper.ExportExcel(dt, fileName, "Contract List", false);
            FileInputHelper.ExportMultiSheetExcelExtend(mypara);
            //return fileName;
        }