public JsonResult dropdownIndex(int FinancialYearId, int FinancialPeriodTypeId, int acid)
        {
            LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);
            ComCodeSL        objComCodeModel     = new ComCodeSL();
            ComCodeDTO       objComCodeDTO       = new ComCodeDTO();

            Common.Common objCommon = new Common.Common();

            if (!objCommon.ValidateCSRFForAJAX())
            {
                return(Json(new
                {
                    status = false,
                    Message = ""
                }, JsonRequestBehavior.AllowGet));
            }
            ViewBag.FinancialYearId = FinancialYearId;
            if (FinancialYearId != 0)
            {
                objComCodeDTO         = objComCodeModel.GetDetails(objLoginUserDetails.CompanyDBConnectionString, FinancialYearId);
                FinancialPeriodTypeId = (objComCodeDTO.ParentCodeId == null ? 0 : Convert.ToInt32(objComCodeDTO.ParentCodeId));
            }
            return(Json(new
            {
                status = true,
                FinancialPeriodTypeId = FinancialPeriodTypeId,
                Message = "Contact Successfully Submitted"
            }, JsonRequestBehavior.AllowGet));
            //return RedirectToAction("Index", "TradingWindowEvent", new { FinancialYearId = FinancialYearId, acid = acid });
        }
예제 #2
0
        //[Button(ButtonName = "dropdown")]
        //[ActionName("dropdownIndex")]
        public JsonResult fillTemplateDropdown(int CommunicationModeCodeId)
        {
            //LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);
            Common.Common objCommon = new Common.Common();
            if (!objCommon.ValidateCSRFForAJAX())
            {
                return(Json(new
                {
                    status = false,
                    Message = ""
                }, JsonRequestBehavior.AllowGet));
            }
            List <PopulateComboDTO> lstList = new List <PopulateComboDTO>();

            if (CommunicationModeCodeId != 0)
            {
                lstList = FillComboValues(ConstEnum.ComboType.TemplateList, Convert.ToString(CommunicationModeCodeId), null, null, null, null, true);
                ViewBag.TemplateList = lstList;
            }
            return(Json(new
            {
                status = true,
                FinancialPeriodTypeId = lstList,
                Message = ""
            }, JsonRequestBehavior.AllowGet));
            //return RedirectToAction("Index", "TradingWindowEvent", new { FinancialYearId = FinancialYearId, acid = acid });
        }
예제 #3
0
 public Body(Database _db, UserModel _user)
 {
     this.db      = _db;
     this.user    = _user;
     this.cm      = new Common.Common(db);
     this.bIsMale = this.user.Gender == "M";
 }
예제 #4
0
파일: Equipment.cs 프로젝트: tomyqg/CGUST
 public ModbusTCP(string sCompanyID, string sEquipmentIDs, int iDBCallTimes, int iEquipmentStateTime)
 {
     gsCompanyID          = sCompanyID;
     gsEquipmentIDs       = sEquipmentIDs;
     giDBCallTimes        = iDBCallTimes;
     giEquipmentStateTime = iEquipmentStateTime;
     wsEEP_Client_WS      = new EEP_Client_WS.EEP_Client_WS();
     objMS_SQL            = new AdapterLogs.AdapterLogs.MS_SQL();
     objCommon            = new Common.Common();
 }
예제 #5
0
파일: Equipment.cs 프로젝트: FTCEEP/CGUST
 public ModbusTCP(string sCompanyID, string sEquipmentIDs, int iDBCallTimes, int iEquipmentStateTime)
 {
     gsCompanyID = sCompanyID;
     gsEquipmentIDs = sEquipmentIDs;
     giDBCallTimes = iDBCallTimes;
     giEquipmentStateTime = iEquipmentStateTime;
     wsEEP_Client_WS = new EEP_Client_WS.EEP_Client_WS();
     objMS_SQL = new AdapterLogs.AdapterLogs.MS_SQL();
     objCommon = new Common.Common();
 }
예제 #6
0
        public ActionResult PartialCreateView2(int CommunicationMode_id)
        {
            LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

            Common.Common objCommon = new Common.Common();
            if (!objCommon.ValidateCSRFForAJAX())
            {
                return(RedirectToAction("Unauthorised", "Home"));
            }
            ViewBag.isAllEdit            = isAllEdit;
            ViewBag.CommunicationMode_id = CommunicationMode_id;
            return(PartialView("PartialCreate2"));
        }
        /// <summary>
        /// 美食展示分页
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult DishesShow(int?id = 1)
        {
            int totalCount             = 0;
            int pageIndex              = id ?? 1;
            int pageSize               = 6;
            PagedList <Dishes> objlist = new DishManager().GetDishes("", pageSize, (pageIndex - 1) * 6, out totalCount).AsQueryable().ToPagedList(pageIndex, pageSize);

            objlist.TotalItemCount   = totalCount;
            objlist.CurrentPageIndex = (int)(id ?? 1);
            Common.Common info = new Common.Common();
            info.objDish = objlist;
            return(View("DishesShow", info));
        }
        public ActionResult NewsManager(int?id = 1)
        {
            int totalCount           = 0;
            int pageIndex            = id ?? 1;
            int pageSize             = 6;
            PagedList <News> objlist = new NewsManager().GetNews("", pageSize, (pageIndex - 1) * 5, out totalCount).AsQueryable().ToPagedList(pageIndex, pageSize);

            objlist.TotalItemCount   = totalCount;
            objlist.CurrentPageIndex = (int)(id ?? 1);
            Common.Common info = new Common.Common();
            info.objNewsModel = objlist;
            return(View("NewsManager", info));
        }
예제 #9
0
        public ActionResult ParentPopulateCombo_OnChange(string CodeId, string CalledFrom, int ParentId, int acid)
        {
            Common.Common objCommon = new Common.Common();
            if (!objCommon.ValidateCSRFForAJAX())
            {
                return(RedirectToAction("Unauthorised", "Home"));
            }
            ViewBag.GridType = ConstEnum.GridType.ComCodeList;
            ViewBag.AddNew   = ParentId;

            ViewBag.UserAction = acid;

            return(PartialView("PartialDataGrid"));
        }
예제 #10
0
        public static Models.ApiResultModel<List<OrdersModel>> GetOrders()
        {
            Common.Common common = new Common.Common();
            try
            {
                OrdersService ordersService = new OrdersService();
                List<OrdersModel> orders = ordersService.GetOrders();

                return common.ThrowResult<List<OrdersModel>>(Enum.ApiStatusEnum.OK, string.Empty, orders);
            }
            catch (Exception ex)
            {
                return common.ThrowResult<List<OrdersModel>>(Enum.ApiStatusEnum.InternalServerError, ex.Message, null);
            }
        }
예제 #11
0
        public static Models.ApiResultModel <List <CustomersModel> > GetCustomers()
        {
            Common.Common common = new Common.Common();
            try
            {
                CustomerDetailService customerDetailService = new CustomerDetailService();
                List <CustomersModel> customers             = customerDetailService.GetCustomers();

                return(common.ThrowResult <List <CustomersModel> >(Enum.ApiStatusEnum.OK, string.Empty, customers));
            }
            catch (Exception ex)
            {
                return(common.ThrowResult <List <CustomersModel> >(Enum.ApiStatusEnum.InternalServerError, ex.Message, null));
            }
        }
예제 #12
0
        public static Models.ApiResultModel <bool> EditAddress(int id, string address)
        {
            Common.Common common = new Common.Common();
            try
            {
                CustomerDetailService customerDetailService = new CustomerDetailService();
                bool r = customerDetailService.EditAddress(id, address);

                return(common.ThrowResult <bool>(Enum.ApiStatusEnum.OK, string.Empty, r));
            }
            catch (Exception ex)
            {
                return(common.ThrowResult <bool>(Enum.ApiStatusEnum.InternalServerError, ex.Message, false));
            }
        }
        public async Task <IHttpActionResult> PostLogin([FromBody] Login data)
        {
            Login login = new Login();

            try
            {
                Common.Common obj = new Common.Common();
                List <Login>  lst = new List <Login>();
                login = await obj.Login(data.Code);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Ok(login));
        }
예제 #14
0
        /// <summary>
        /// This method is used to fetch sub category drop down view (partial)
        /// </summary>
        /// <param name="category_id"></param>
        /// <returns></returns>
        public ActionResult PartialCreateView(int CommunicationMode_id)
        {
            Common.Common objCommon = new Common.Common();
            if (!objCommon.ValidateCSRFForAJAX())
            {
                return(RedirectToAction("Unauthorised", "Home"));
            }
            CommunicationRuleMasterModel objCommunicationRuleMasterModel = new CommunicationRuleMasterModel();
            LoginUserDetails             objLoginUserDetails             = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);
            List <PopulateComboDTO>      lstList = new List <PopulateComboDTO>();

            ViewBag.isAllEdit                        = isAllEdit;
            lstList                                  = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.Events).ToString(), null, null, null, null, false);
            ViewBag.TriggerEventCodeList             = lstList;
            lstList                                  = FillComboValues(ConstEnum.ComboType.ListofEventsWithUserTypeForCommunicatioTriggerEvent, null, null, null, null, null, false);
            ViewBag.TriggerEventCodeWithUserTypeList = lstList;
            lstList                                  = FillComboValues(ConstEnum.ComboType.ListOfCode, Convert.ToInt32(ConstEnum.CodeGroup.Events).ToString(), null, null, null, null, false);
            ViewBag.OffsetEventCodeList              = lstList;
            objCommunicationRuleMasterModel.AssignedTriggerEventCodeId = new List <PopulateComboDTO>();
            objCommunicationRuleMasterModel.AssignedOffsetEventCodeId  = new List <PopulateComboDTO>();
            ViewBag.CommunicationMode_id = CommunicationMode_id;
            return(PartialView("PartialCreate1", objCommunicationRuleMasterModel));
        }
예제 #15
0
        private void bt_print_Click(object sender, EventArgs e)
        {
            //RdlcPrintNew rdlcprint = new RdlcPrintNew();
            //rdlcprint.Run(reportView.LocalReport, "单据打印", false, "A4");

            //DataGridViewExport.DataGridviewShowToExcel(dgv_tjxm,false);

            string path      = "";
            bool   overWrite = true;

            if (dgv_tjxm.Rows.Count == 0)
            {
                return;
            }

            Common.Common comn = new Common.Common();

            saveFileDialog1.Filter = "Excel File|*.xls";
            saveFileDialog1.Title  = "数据导出";

            if (saveFileDialog1.ShowDialog() != DialogResult.Cancel)
            {
                path = saveFileDialog1.FileName;
                DataGridViewExport.ExportToExcel(dgv_tjxm, path, "s", overWrite);
            }

            DialogResult result = MessageBox.Show("是否打开Excel文件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.No)
            {
                return;
            }
            if (DataGridViewExport.IsExistsExcel())
            {
                DataGridViewExport.OpenExcel(path);
            }
        }
예제 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BLL.Administrator   bllAdministrator   = new BLL.Administrator();
            Model.Administrator modelAdministrator = new Model.Administrator();
            Common.Common       common             = new Common.Common();
            string ManagerGUID = "";

            switch (Request["ActionMethod"])
            {
            case "OpenCreate":
                break;

            case "OpenEdit":
                ManagerGUID              = common.SQLFilter(Request["ManagerGUID"]);
                modelAdministrator       = bllAdministrator.ExGetModel(ManagerGUID);
                txtManagerUserName.Value = modelAdministrator.AdminUser;
                txtManagerName.Value     = modelAdministrator.AdminAccount;
                break;

            default:
                common.MsgAndClose("服务器错误,请重试!7516", this);
                break;
            }
        }
예제 #17
0
        public ActionResult ChangePassword(int formId, int acid, PasswordManagementModel objPwdMgmtModel)
        {
            bool                          bErrorOccurred               = false;
            string                        i_ErrorMessage               = "";
            LoginUserDetails              objLoginUserDetails          = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);
            PasswordManagementDTO         objPwdMgmtDTO                = new PasswordManagementDTO();
            PasswordConfigModel           objPassConfigModel           = new PasswordConfigModel();
            UserInfoSL                    objUserInfoSL                = new UserInfoSL();
            UserPolicyDocumentEventLogDTO objChangePasswordEventLogDTO = null;
            PasswordExpiryReminderDTO     objPassExpiryReminderDTO     = null;


            InsiderTradingEncryption.DataSecurity objPwdHash = new InsiderTradingEncryption.DataSecurity();
            try
            {
                DataSecurity objDataSecurity         = new DataSecurity();
                string       sOldPassword            = string.Empty;
                string       sNewPassword            = string.Empty;
                string       sConfirmNewPassword     = string.Empty;
                string       sPasswordHash           = string.Empty;
                string       sPasswordHashWithSalt   = string.Empty;
                string       sSaltValue              = string.Empty;
                string       javascriptEncryptionKey = Common.ConstEnum.Javascript_Encryption_Key;
                string       userPasswordHashSalt    = Common.ConstEnum.User_Password_Encryption_Key;

                if (objPwdMgmtModel.OldPassword == null || objPwdMgmtModel.OldPassword == "" || objPwdMgmtModel.NewPassword == null || objPwdMgmtModel.NewPassword == "" ||
                    objPwdMgmtModel.ConfirmNewPassword == null || objPwdMgmtModel.ConfirmNewPassword == "")
                {
                    i_ErrorMessage = "All fields are required fields.";
                    bErrorOccurred = true;
                }
                else if (objPwdMgmtModel.NewPassword == null || objPwdMgmtModel.NewPassword == "" || objPwdMgmtModel.ConfirmNewPassword == null || objPwdMgmtModel.ConfirmNewPassword == "")
                {
                    i_ErrorMessage = "Please enter new password and confirm new password.";
                    bErrorOccurred = true;
                }
                else if (objPwdMgmtModel.NewPassword != objPwdMgmtModel.ConfirmNewPassword)
                {
                    i_ErrorMessage = "New password and Confirm password are not matching.";
                    bErrorOccurred = true;
                }
                else if (objPwdMgmtModel.OldPassword == objPwdMgmtModel.NewPassword)
                {
                    i_ErrorMessage = "New password should not be same as old password.";
                    bErrorOccurred = true;
                }

                else if (!string.IsNullOrEmpty(objPwdMgmtModel.OldPassword) && !string.IsNullOrEmpty(objPwdMgmtModel.NewPassword) &&
                         !string.IsNullOrEmpty(objPwdMgmtModel.ConfirmNewPassword))
                {
                    sOldPassword          = DecryptStringAES(objPwdMgmtModel.OldPassword, javascriptEncryptionKey, javascriptEncryptionKey);
                    sNewPassword          = DecryptStringAES(objPwdMgmtModel.NewPassword, javascriptEncryptionKey, javascriptEncryptionKey);
                    sConfirmNewPassword   = DecryptStringAES(objPwdMgmtModel.ConfirmNewPassword, javascriptEncryptionKey, javascriptEncryptionKey);
                    sPasswordHashWithSalt = objPwdHash.CreateSaltandHash(sNewPassword);
                    sPasswordHash         = sPasswordHashWithSalt.Split('~')[0].ToString();
                    sSaltValue            = sPasswordHashWithSalt.Split('~')[1].ToString();
                }

                //Check if the new password follows Password policy
                if (!bErrorOccurred)
                {
                    Common.Common objCommon       = new Common.Common();
                    bool          isPasswordValid = objCommon.ValidatePassword(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.UserName, sNewPassword, sPasswordHash, objLoginUserDetails.LoggedInUserID, out i_ErrorMessage);
                    if (!isPasswordValid)
                    {
                        bErrorOccurred = true;
                    }
                }
                if (bErrorOccurred)
                {
                    ViewBag.LoginError = i_ErrorMessage;
                    return(View("ChangePassword"));
                }

                objPwdMgmtModel.UserInfoID = objLoginUserDetails.LoggedInUserID;

                string saltValue  = string.Empty;
                string calledFrom = "ChangPwd";

                using (UserInfoSL ObjUserInfoSL = new UserInfoSL())
                {
                    List <AuthenticationDTO> lstUserDetails = ObjUserInfoSL.GetUserLoginDetails(objLoginUserDetails.CompanyDBConnectionString, Convert.ToString(objLoginUserDetails.LoggedInUserID), calledFrom);
                    foreach (var UserDetails in lstUserDetails)
                    {
                        saltValue = UserDetails.SaltValue;
                    }
                }

                string usrSaltValue = (saltValue == null || saltValue == string.Empty) ? userPasswordHashSalt : saltValue;

                if (saltValue != null && saltValue != "")
                {
                    objPwdMgmtModel.OldPassword = objPwdHash.CreateHashToVerify(sOldPassword, usrSaltValue);
                }
                else
                {
                    objPwdMgmtModel.OldPassword = objPwdHash.CreateHash(sOldPassword, usrSaltValue);
                }


                objPwdMgmtModel.NewPassword        = sPasswordHash;
                objPwdMgmtModel.ConfirmNewPassword = sPasswordHash;
                objPwdMgmtModel.SaltValue          = sSaltValue;
                InsiderTrading.Common.Common.CopyObjectPropertyByName(objPwdMgmtModel, objPwdMgmtDTO);
                objUserInfoSL.ChangePassword(objLoginUserDetails.CompanyDBConnectionString, ref objPwdMgmtDTO);
                objLoginUserDetails.PasswordChangeMessage = Common.Common.getResource("usr_msg_11271");
                Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails);

                Common.Common.SetSessionValue("IsChangePassword", false);
            }
            catch (Exception exp)
            {
                string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString());
                ViewBag.LoginError = sErrMessage;
                objPassConfigModel = GetPasswordConfigDetails();
                return(View("ChangePassword"));
            }
            finally
            {
                objLoginUserDetails = null;
                objPwdMgmtDTO       = null;
                objUserInfoSL       = null;
                objPwdHash          = null;
            }
            return(RedirectToAction("Index", "Home", new { acid = Convert.ToString(Common.ConstEnum.UserActions.CRUSER_COUSERDASHBOARD_DASHBOARD) }));
        }
예제 #18
0
        public ActionResult SetPassword(PasswordManagementModel objPwdMgmtModel)
        {
            bool   bErrorOccurred = false;
            string i_ErrorMessage = "";
            string NewPassword    = null;

            InsiderTradingDAL.CompanyDTO objSelectedCompany = new CompanyDTO();
            UserInfoDTO      objUserInfoDTO      = new UserInfoDTO();
            LoginUserDetails objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

            try
            {
                if (objLoginUserDetails == null)
                {
                    objLoginUserDetails = new LoginUserDetails();
                }

                if (objPwdMgmtModel.CompanyID == null || objPwdMgmtModel.CompanyID == "")
                {
                    i_ErrorMessage = "Company is required field.";
                    bErrorOccurred = true;
                }
                else if (objPwdMgmtModel.NewPassword == null || objPwdMgmtModel.NewPassword == "" || objPwdMgmtModel.ConfirmNewPassword == null || objPwdMgmtModel.ConfirmNewPassword == "")
                {
                    i_ErrorMessage = "Please enter new password and confirm password.";
                    bErrorOccurred = true;
                }
                else if (objPwdMgmtModel.NewPassword != objPwdMgmtModel.ConfirmNewPassword)
                {
                    i_ErrorMessage = "New password and Confirm password are not matching.";
                    bErrorOccurred = true;
                }

                if (System.Configuration.ConfigurationManager.AppSettings["CompanyType"] == "Textbox")
                {
                    Dictionary <string, string> objCompaniesDictionary = null;

                    objCompaniesDictionary = new Dictionary <string, string>();

                    using (CompaniesSL objCompanySL = new CompaniesSL())
                    {
                        foreach (InsiderTradingDAL.CompanyDTO objCompanyDTO in objCompanySL.getAllCompanies(Common.Common.getSystemConnectionString()))
                        {
                            objCompaniesDictionary.Add(objCompanyDTO.sCompanyDatabaseName, objCompanyDTO.sCompanyName.ToLower());
                        }
                    }

                    if (objCompaniesDictionary.ContainsValue(objPwdMgmtModel.CompanyID.ToLower()))
                    {
                        objPwdMgmtModel.CompanyID = (from entry in objCompaniesDictionary
                                                     where entry.Value.ToLower() == objPwdMgmtModel.CompanyID.ToLower()
                                                     select entry.Key).FirstOrDefault();
                    }
                    else
                    {
                        objLoginUserDetails.ErrorMessage = "Invalid Company Name";
                        Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails);
                        return(RedirectToAction("SetPassword", "Account", new { code = objPwdMgmtModel.HashValue }));
                    }
                }

                //hashed password to check password history
                InsiderTradingEncryption.DataSecurity objPwdHash = new InsiderTradingEncryption.DataSecurity();

                string saltValue = string.Empty;
                if (objPwdMgmtModel.NewPassword != null)
                {
                    //NewPassword = objPwdHash.CreateSaltandHash(objPwdMgmtModel.NewPassword);
                    string sPasswordHashWithSalt = objPwdHash.CreateSaltandHash(objPwdMgmtModel.NewPassword);
                    NewPassword = sPasswordHashWithSalt.Split('~')[0].ToString();
                    saltValue   = sPasswordHashWithSalt.Split('~')[1].ToString();
                }
                using (CompaniesSL objCompanySL = new CompaniesSL())
                {
                    objSelectedCompany = objCompanySL.getSingleCompanies(Common.Common.getSystemConnectionString(), objPwdMgmtModel.CompanyID);
                }
                //Check if the new password follows Password policy
                if (!bErrorOccurred)
                {
                    Common.Common         objCommon = new Common.Common();
                    PasswordManagementDTO objPasswordManagementUserFromHashCodeDTO = new PasswordManagementDTO();

                    using (UserInfoSL objUserInfoSL = new UserInfoSL())
                    {
                        objPasswordManagementUserFromHashCodeDTO = objUserInfoSL.GetUserFromHashCode(objSelectedCompany.CompanyConnectionString, objPwdMgmtModel.HashValue);
                        objUserInfoDTO = objUserInfoSL.GetUserDetails(objSelectedCompany.CompanyConnectionString, objPasswordManagementUserFromHashCodeDTO.UserInfoID);
                    }
                    bool isPasswordValid = objCommon.ValidatePassword(objSelectedCompany.CompanyConnectionString, objUserInfoDTO.LoginID, objPwdMgmtModel.NewPassword, NewPassword, objUserInfoDTO.UserInfoId, out i_ErrorMessage);
                    if (!isPasswordValid)
                    {
                        bErrorOccurred = true;
                    }
                }
                if (bErrorOccurred)
                {
                    //ModelState.AddModelError("Error", i_ErrorMessage);
                    if (objLoginUserDetails == null)
                    {
                        objLoginUserDetails = new LoginUserDetails();
                    }
                    objLoginUserDetails.ErrorMessage = i_ErrorMessage;
                    objLoginUserDetails.CompanyName  = objPwdMgmtModel.CompanyID;
                    Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails);

                    PasswordConfigSL  objPassConfigSL  = new PasswordConfigSL();
                    PasswordConfigDTO objPassConfigDTO = new PasswordConfigDTO();
                    objPassConfigDTO = objPassConfigSL.GetPasswordConfigDetails(objSelectedCompany.CompanyConnectionString);
                    PasswordConfigModel objPassConfigModel = new PasswordConfigModel();
                    InsiderTrading.Common.Common.CopyObjectPropertyByName(objPassConfigDTO, objPassConfigModel);
                    TempData["PasswordConfigModel"] = objPassConfigModel;
                    return(RedirectToAction("SetPassword", "Account", new { code = objPwdMgmtModel.HashValue }));
                    //return View("SetPassword", objPwdMgmtModel);
                }

                PasswordManagementDTO objPwdMgmtDTO = new PasswordManagementDTO();

                if (objLoginUserDetails == null)
                {
                    objLoginUserDetails = new LoginUserDetails();
                }
                if (objSelectedCompany == null)
                {
                    objLoginUserDetails.ErrorMessage = "Entered company is incorrect, please enter correct company and try again.";
                }
                else
                {
                    objPwdMgmtModel.NewPassword        = NewPassword;
                    objPwdMgmtModel.ConfirmNewPassword = NewPassword;
                    objPwdMgmtModel.SaltValue          = saltValue;
                    InsiderTrading.Common.Common.CopyObjectPropertyByName(objPwdMgmtModel, objPwdMgmtDTO);
                    using (UserInfoSL objUserInfoSL = new UserInfoSL())
                    {
                        objPwdMgmtDTO.UserInfoID = objUserInfoDTO.UserInfoId;
                        objUserInfoSL.ChangePassword(objSelectedCompany.CompanyConnectionString, ref objPwdMgmtDTO);
                    }
                    //InsiderTradingDAL.UserInfoDTO objUserInfo = objUserInfoSL.GetUserDetails(objSelectedCompany.CompanyConnectionString, objPwdMgmtDTO.UserInfoID);
                    objLoginUserDetails.SuccessMessage = Common.Common.getResourceForGivenCompany("usr_msg_11271", objSelectedCompany.sCompanyDatabaseName);
                }


                Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails);
                return(RedirectToAction("Login", "Account"));
                //return RedirectToAction("Index", "Home", new { acid = Convert.ToString(Common.ConstEnum.UserActions.CRUSER_COUSERDASHBOARD_DASHBOARD) });
            }
            catch (Exception exp)
            {
                string sErrMessage = Common.Common.getResourceForGivenCompany(exp.InnerException.Data[0].ToString(), objSelectedCompany.sCompanyDatabaseName);
                if (objLoginUserDetails == null)
                {
                    objLoginUserDetails = new LoginUserDetails();
                }
                objLoginUserDetails.ErrorMessage = sErrMessage;
                Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails);
                return(RedirectToAction("Login", "Account"));
                //ModelState.AddModelError("Error", sErrMessage);
                //return View("SetPassword", objPwdMgmtModel);
            }
            finally
            {
                objLoginUserDetails = null;
            }
        }
예제 #19
0
 private void txt_bl_Leave(object sender, EventArgs e)
 {
     Common.Common comn = new Common.Common();
     txt_bl.Text = comn.CharConverter(txt_bl.Text.Trim());
 }
예제 #20
0
        private void btnSf_Click(object sender, EventArgs e)
        {
            #region 输入检查
            if (str_tjbh == "")
            {
                MessageBox.Show("请选择一条人员信息!", "提示");
                return;
            }
            if (str_tjcs == "")
            {
                MessageBox.Show("请选择一条人员信息!", "提示");
                return;
            }

            Common.Common comn = new Common.Common();
            if (rbt_je.Checked == true)
            {
                if (comn.DoubleYz(txt_je.Text.Trim()) == -1 || comn.Szyz(txt_je.Text.Trim()) == -1)  //既不是双精度又不是数字
                {
                    MessageBox.Show("请输入正确的金额格式,如:100.5或100", "提示");
                    txt_je.Focus();
                    return;
                }
                if (Convert.ToDecimal(txt_je.Text.Trim()) > ysje)
                {
                    MessageBox.Show("最大金额优惠不能大于应收金额!", "提示");
                    txt_je.Focus();
                    return;
                }
                if (txt_yhbz.Text == "")
                {
                    MessageBox.Show("请输入优惠备注信息!", "提示");
                    txt_yhbz.Focus();
                    return;
                }
            }
            if (rbt_bl.Checked == true)
            {
                if (comn.DoubleYz(txt_bl.Text.Trim()) == -1 || comn.Szyz(txt_bl.Text.Trim()) == -1)  //既不是双精度又不是数字
                {
                    MessageBox.Show("请输入正确的比例格式,如:9或9.5", "提示");
                    txt_bl.Focus();
                    return;
                }
                if (Convert.ToDecimal(txt_bl.Text.Trim()) > 100)
                {
                    MessageBox.Show("优惠比例不能大于或等于100!", "提示");
                    txt_je.Focus();
                    return;
                }
                if (txt_yhbz.Text == "")
                {
                    MessageBox.Show("请输入优惠备注信息!", "提示");
                    txt_yhbz.Focus();
                    return;
                }
            }
            #endregion

            string sfh = xtbiz.GetHmz("tj_sjh", 1);
            str_sfhdy = sfh;
            #region 优惠处理
            int     yhlx = 0;
            decimal ssje = 0;
            decimal yhxx = 0;

            if (rbt_je.Checked == true || txt_je.Text.Trim() != "")
            {
                yhlx = 1;                                     //金额优惠
                yhxx = Convert.ToDecimal(txt_je.Text.Trim()); //优惠信息
                ssje = ysje - yhxx;                           //应收-优惠金额
            }

            if (rbt_bl.Checked == true || txt_bl.Text.Trim() != "")
            {
                yhlx = 2;                          //比例优惠
                yhxx = Convert.ToDecimal(txt_bl.Text.Trim());
                ssje = ysje - ysje * (yhxx / 100); //应收-应收*优惠比例
            }

            if (rbt_bl.Checked == false && rbt_je.Checked == false)
            {
                ssje = ysje;
            }

            #endregion

            #region 收费保存,打印
            try
            {
                int k = tjdjbiz.TjSf(sfh, str_tjbh, str_tjcs, Program.userid, ysje, ssje, yhlx, yhxx, sfh, txt_yhbz.Text.Trim());
                if (k > 0)
                {
                    MessageBox.Show("收费成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    #region 日志记录
                    loginbiz.WriteLog(this.Name.Trim(), "【" + Program.username + "】" + "在电脑【" + ma.HostName() + "】上收费成功,收费号是:" + sfh + ",IP:" + Program.hostip, Program.username);
                    #endregion

                    txt_bl.Text = "";
                    txt_je.Text = "";
                    btn_query_Click(null, null);
                    dgvFyxx.DataSource = tjdjbiz.GetTjfyxx("", "");;
                    btnSf.Enabled      = false;
                    string sfdyfp = xtbiz.GetXtCsz("sfdyfp"); //是否打印收费发票
                    if (sfdyfp == "1")                        //1打印,0不打印
                    {
                        PrintRdlc(str_tjbh, str_tjcs, sfh);
                    }
                }
            }
            catch (Exception ex)
            {
                #region 错误日志
                loginbiz.WriteLogErr(this.Name.Trim(), "【" + Program.username + "】" + "在电脑【" + ma.HostName() + "】上收费是出现异常,错误原因:" + ex.ToString() + ",IP:" + Program.hostip, Program.username);
                #endregion

                MessageBox.Show(ex.ToString());
                return;
            }
            #endregion
        }
예제 #21
0
        private void btn_bzsf_Click(object sender, EventArgs e)
        {
            #region 输入检查
            if (str_tjbh_bz == "")
            {
                MessageBox.Show("请选择一条人员信息!", "提示");
                return;
            }
            if (str_tjcs_bz == "")
            {
                MessageBox.Show("请选择一条人员信息!", "提示");
                return;
            }
            if (txt_sfbeizhu.Text == "")
            {
                MessageBox.Show("请输入收费备注!费办卡可以输入收费项目名称!", "提示");
                this.ActiveControl = txt_sfbeizhu;
                return;
            }


            Common.Common comn = new Common.Common();

            if (comn.DoubleYz(txt_bzsfje.Text.Trim()) == -1 || comn.Szyz(txt_bzsfje.Text.Trim()) == -1)  //既不是双精度又不是数字
            {
                MessageBox.Show("请输入正确的金额格式,如:100.5或100", "提示");
                txt_je.Focus();
                return;
            }
            #endregion

            string sfh = xtbiz.GetHmz("tj_sjh", 1);
            #region 办证收费保存,打印
            try
            {
                int k = tjdjbiz.TjSf(sfh, str_tjbh_bz, str_tjcs_bz, Program.userid, Convert.ToDecimal(txt_bzsfje.Text.Trim()), Convert.ToDecimal(txt_bzsfje.Text.Trim()), 2, 0, sfh, txt_sfbeizhu.Text.Trim());
                if (k > 0)
                {
                    MessageBox.Show("收费成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    #region 日志记录
                    loginbiz.WriteLog(this.Name.Trim(), "【" + Program.username + "】" + "在电脑【" + ma.HostName() + "】上补证收费成功,收费号是:" + sfh + ",IP:" + Program.hostip, Program.username);
                    #endregion
                    button1_Click(null, null);
                    btn_bzsf.Enabled = false;
                    string sfdyfp = xtbiz.GetXtCsz("sfdybzfp"); //是否打印办证收费发票
                    if (sfdyfp == "1")                          //1打印,0不打印
                    {
                        PrintRdlc(str_tjbh_bz, str_tjcs_bz, sfh);
                    }
                }
            }
            catch (Exception ex)
            {
                #region 错误日志
                loginbiz.WriteLogErr(this.Name.Trim(), "【" + Program.username + "】" + "在电脑【" + ma.HostName() + "】上收补证费出现异常,错误原因:" + ex.ToString() + ",IP:" + Program.hostip, Program.username);
                #endregion
                MessageBox.Show(ex.ToString());
                btn_bzsf.Enabled = false;
                return;
            }
            #endregion
        }
예제 #22
0
        public JsonResult Apply(string nAllEmployeeFlag, string nAllInsiderFlag, string nAllEmployeeInsiderFlag, string nAllCoFlag, string nAllCorporateInsiderFlag, string nAllNonEmployeeInsiderFlag, string sMapToId, string sMapToTypeCodeId, string arrIncluded, string arrExcluded, string arrFilter, string arrnonInsEmpFilter, int acid, string __RequestVerificationToken = "", int formId = 0)
        {
            bool statusFlag = false;

            var ErrorDictionary = new Dictionary <string, string>();

            string[][] arrApplicabilityInclude = null;
            string[]   arrApplicabilityExclude = null;
            List <ApplicabilityFilter>          arrFilterList          = null;
            List <NonInsEmpApplicabilityFilter> arrFilterNonInsEmpList = null;

            LoginUserDetails objLoginUserDetails = null;

            DataTable tblApplicabilityUserIncludeExclude  = null;
            DataTable tblApplicabilityFilterType          = null;
            DataTable tblNonInsEmpApplicabilityFilterType = null;

            Common.Common objCommon = new Common.Common();
            try
            {
                if (!objCommon.ValidateCSRFForAJAX())
                {
                    return(Json(new
                    {
                        status = statusFlag,
                        Message = ErrorDictionary
                    }, JsonRequestBehavior.AllowGet));
                }
                objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails);

                if (arrIncluded != "")
                {
                    arrApplicabilityInclude = JsonConvert.DeserializeObject <string[][]>(arrIncluded);
                }

                if (arrExcluded != "")
                {
                    arrApplicabilityExclude = JsonConvert.DeserializeObject <string[]>(arrExcluded);
                }

                if (arrFilter != "")
                {
                    arrFilterList = JsonConvert.DeserializeObject <List <ApplicabilityFilter> >(arrFilter);
                }


                if (arrnonInsEmpFilter != "")
                {
                    arrFilterNonInsEmpList = JsonConvert.DeserializeObject <List <NonInsEmpApplicabilityFilter> >(arrnonInsEmpFilter);
                }

                tblApplicabilityUserIncludeExclude = new DataTable("ApplicabilityUserIncludeExcludeType");

                tblApplicabilityUserIncludeExclude.Columns.Add(new DataColumn("UserId", typeof(int)));
                tblApplicabilityUserIncludeExclude.Columns.Add(new DataColumn("InsiderTypeCodeId", typeof(int)));
                tblApplicabilityUserIncludeExclude.Columns.Add(new DataColumn("IncludeExcludeCodeId", typeof(int)));

                if (arrApplicabilityInclude != null)
                {
                    for (int i = 0; i < arrApplicabilityInclude.Length; i++)
                    {
                        int UserTypeCodeId = i == 0 ? ConstEnum.Code.EmployeeType : i == 1 ? ConstEnum.Code.CorporateUserType : i == 2 ? ConstEnum.Code.NonEmployeeType : i == 3 ? ConstEnum.Code.COUserType : ConstEnum.Code.EmployeeType;

                        DataRow row = null;

                        for (int j = 0; j < arrApplicabilityInclude[i].Length; j++)
                        {
                            row = tblApplicabilityUserIncludeExclude.NewRow();

                            row["UserId"]               = Convert.ToInt32(arrApplicabilityInclude[i][j]);
                            row["InsiderTypeCodeId"]    = UserTypeCodeId;
                            row["IncludeExcludeCodeId"] = InsiderTrading.Common.ConstEnum.Code.IncludeTypeCode;

                            tblApplicabilityUserIncludeExclude.Rows.Add(row);
                        }

                        row = null;
                    }
                }

                if (arrApplicabilityExclude != null)
                {
                    DataRow row = null;

                    for (int i = 0; i < arrApplicabilityExclude.Length; i++)
                    {
                        row = tblApplicabilityUserIncludeExclude.NewRow();

                        row["UserId"]               = Convert.ToInt32(arrApplicabilityExclude[i]);
                        row["InsiderTypeCodeId"]    = ConstEnum.Code.EmployeeType;
                        row["IncludeExcludeCodeId"] = InsiderTrading.Common.ConstEnum.Code.ExcludeTypeCode;

                        tblApplicabilityUserIncludeExclude.Rows.Add(row);
                    }

                    row = null;
                }

                tblApplicabilityFilterType = new DataTable("ApplicabilityFilterType");

                tblApplicabilityFilterType.Columns.Add(new DataColumn("ApplicabilityDtlsId", typeof(int)));
                tblApplicabilityFilterType.Columns.Add(new DataColumn("DepartmentCodeId", typeof(int)));
                tblApplicabilityFilterType.Columns.Add(new DataColumn("GradeCodeId", typeof(int)));
                tblApplicabilityFilterType.Columns.Add(new DataColumn("DesignationCodeId", typeof(int)));
                tblApplicabilityFilterType.Columns.Add(new DataColumn("CategoryCodeId", typeof(int)));
                tblApplicabilityFilterType.Columns.Add(new DataColumn("SubCategoryCodeId", typeof(int)));
                tblApplicabilityFilterType.Columns.Add(new DataColumn("RoleId", typeof(int)));

                tblNonInsEmpApplicabilityFilterType = new DataTable("NonInsEmpApplicabilityFilterType");

                tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("ApplicabilityDtlsId", typeof(int)));
                tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("DepartmentCodeId", typeof(int)));
                tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("GradeCodeId", typeof(int)));
                tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("DesignationCodeId", typeof(int)));
                tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("CategoryCodeId", typeof(int)));
                tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("SubCategoryCodeId", typeof(int)));
                tblNonInsEmpApplicabilityFilterType.Columns.Add(new DataColumn("RoleId", typeof(int)));
                if (arrFilterList != null)
                {
                    DataRow row = null;

                    foreach (var objFilter in arrFilterList)
                    {
                        row = tblApplicabilityFilterType.NewRow();

                        row["ApplicabilityDtlsId"] = 0;
                        row["DepartmentCodeId"]    = DBNull.Value;
                        row["GradeCodeId"]         = DBNull.Value;
                        row["DesignationCodeId"]   = DBNull.Value;
                        row["CategoryCodeId"]      = DBNull.Value;
                        row["SubCategoryCodeId"]   = DBNull.Value;
                        row["RoleId"] = DBNull.Value;

                        if (objFilter.ApplicabilityDtlsId != "" && objFilter.ApplicabilityDtlsId != "0")
                        {
                            row["ApplicabilityDtlsId"] = Convert.ToInt32(objFilter.ApplicabilityDtlsId);
                        }

                        if (objFilter.DepartmentId != "" && objFilter.DepartmentId != "0")
                        {
                            row["DepartmentCodeId"] = Convert.ToInt32(objFilter.DepartmentId);
                        }

                        if (objFilter.GradeId != "" && objFilter.GradeId != "0")
                        {
                            row["GradeCodeId"] = Convert.ToInt32(objFilter.GradeId);
                        }

                        if (objFilter.DesignationId != "" && objFilter.DesignationId != "0")
                        {
                            row["DesignationCodeId"] = Convert.ToInt32(objFilter.DesignationId);
                        }

                        if (objFilter.CategoryId != "" && objFilter.CategoryId != "0")
                        {
                            row["CategoryCodeId"] = Convert.ToInt32(objFilter.CategoryId);
                        }

                        if (objFilter.SubCategoryId != "" && objFilter.SubCategoryId != "0")
                        {
                            row["SubCategoryCodeId"] = Convert.ToInt32(objFilter.SubCategoryId);
                        }

                        if (objFilter.RoleId != "" && objFilter.RoleId != "0")
                        {
                            row["RoleId"] = Convert.ToInt32(objFilter.RoleId);
                        }

                        if (row["DesignationCodeId"] != DBNull.Value || row["GradeCodeId"] != DBNull.Value || row["DepartmentCodeId"] != DBNull.Value || row["CategoryCodeId"] != DBNull.Value || row["SubCategoryCodeId"] != DBNull.Value || row["RoleId"] != DBNull.Value)
                        {
                            tblApplicabilityFilterType.Rows.Add(row);
                        }
                    }

                    row = null;
                }
                if (arrFilterNonInsEmpList != null)
                {
                    DataRow row = null;

                    foreach (var objFilter in arrFilterNonInsEmpList)
                    {
                        row = tblNonInsEmpApplicabilityFilterType.NewRow();

                        row["ApplicabilityDtlsId"] = 0;
                        row["DepartmentCodeId"]    = DBNull.Value;
                        row["GradeCodeId"]         = DBNull.Value;
                        row["DesignationCodeId"]   = DBNull.Value;
                        row["CategoryCodeId"]      = DBNull.Value;
                        row["SubCategoryCodeId"]   = DBNull.Value;
                        row["RoleId"] = DBNull.Value;

                        if (objFilter.ApplicabilityDtlsId != "" && objFilter.ApplicabilityDtlsId != "0")
                        {
                            row["ApplicabilityDtlsId"] = Convert.ToInt32(objFilter.ApplicabilityDtlsId);
                        }

                        if (objFilter.DepartmentId != "" && objFilter.DepartmentId != "0")
                        {
                            row["DepartmentCodeId"] = Convert.ToInt32(objFilter.DepartmentId);
                        }

                        if (objFilter.GradeId != "" && objFilter.GradeId != "0")
                        {
                            row["GradeCodeId"] = Convert.ToInt32(objFilter.GradeId);
                        }

                        if (objFilter.DesignationId != "" && objFilter.DesignationId != "0")
                        {
                            row["DesignationCodeId"] = Convert.ToInt32(objFilter.DesignationId);
                        }

                        if (objFilter.CategoryId != "" && objFilter.CategoryId != "0")
                        {
                            row["CategoryCodeId"] = Convert.ToInt32(objFilter.CategoryId);
                        }

                        if (objFilter.SubCategoryId != "" && objFilter.SubCategoryId != "0")
                        {
                            row["SubCategoryCodeId"] = Convert.ToInt32(objFilter.SubCategoryId);
                        }

                        if (objFilter.RoleId != "" && objFilter.RoleId != "0")
                        {
                            row["RoleId"] = Convert.ToInt32(objFilter.RoleId);
                        }

                        if (row["DesignationCodeId"] != DBNull.Value || row["GradeCodeId"] != DBNull.Value || row["DepartmentCodeId"] != DBNull.Value || row["CategoryCodeId"] != DBNull.Value || row["SubCategoryCodeId"] != DBNull.Value || row["RoleId"] != DBNull.Value)
                        {
                            tblNonInsEmpApplicabilityFilterType.Rows.Add(row);
                        }
                    }

                    row = null;
                }
                using (ApplicabilitySL objApplicabilitySl = new ApplicabilitySL())
                {
                    int nCountOverlapPolicy = 0;

                    objApplicabilitySl.InsertDeleteApplicability(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(sMapToTypeCodeId), Convert.ToInt32(sMapToId), Convert.ToInt32(nAllEmployeeFlag), Convert.ToInt32(nAllInsiderFlag), Convert.ToInt32(nAllEmployeeInsiderFlag), Convert.ToInt32(nAllCoFlag), Convert.ToInt32(nAllCorporateInsiderFlag), Convert.ToInt32(nAllNonEmployeeInsiderFlag), tblApplicabilityFilterType, tblNonInsEmpApplicabilityFilterType, tblApplicabilityUserIncludeExclude, objLoginUserDetails.LoggedInUserID, out nCountOverlapPolicy);

                    statusFlag = true;

                    ErrorDictionary.Add("success", "Applicability saved successfully.");
                    ErrorDictionary.Add("CountOverlapPolicy", Convert.ToString(nCountOverlapPolicy));
                }
            }
            catch (Exception exp)
            {
                ModelState.Remove("KEY");
                ModelState.Add("KEY", new ModelState());
                ModelState.Clear();

                string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString());

                ModelState.AddModelError("error", sErrMessage);

                ErrorDictionary = GetModelStateErrorsAsString();
            }
            finally
            {
                objLoginUserDetails = null;

                arrApplicabilityInclude = null;
                arrApplicabilityExclude = null;
                arrFilterList           = null;

                tblApplicabilityUserIncludeExclude = null;
                tblApplicabilityFilterType         = null;
            }

            return(Json(new
            {
                status = statusFlag,
                Message = ErrorDictionary
            }, JsonRequestBehavior.AllowGet));
        }
예제 #23
0
        public ActionResult PopulateCombo_OnChange(string CodeId, string CalledFrom, int ParentId, int acid)
        {
            LoginUserDetails objLoginUserDetails = null;

            ComCodeModel     objComCodeModel     = null;
            PopulateComboDTO objPopulateComboDTO = null;

            List <PopulateComboDTO> lstParentCodeGroup = null;
            List <PopulateComboDTO> lstLabelForParent  = null;
            List <PopulateComboDTO> lstCodeGroup       = null;

            string sView = string.Empty;

            Common.Common objCommon = new Common.Common();
            try
            {
                if (!objCommon.ValidateCSRFForAJAX())
                {
                    return(RedirectToAction("Unauthorised", "Home"));
                }
                string   ParentLabel = "";
                string[] arr         = new String[2];

                objComCodeModel     = new ComCodeModel();
                objPopulateComboDTO = new PopulateComboDTO();

                objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

                arr = CodeId.Split(new string[] { "-" }, StringSplitOptions.None);

                if (Convert.ToInt32(arr[1]) != 0)
                {
                    objPopulateComboDTO.Key   = "0";
                    objPopulateComboDTO.Value = "Select";

                    lstParentCodeGroup = new List <PopulateComboDTO>();
                    lstParentCodeGroup.Add(objPopulateComboDTO);
                    lstParentCodeGroup.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.ListOfCode,
                                                                               arr[1], null, null, null, null, sLookUpPrefix));

                    lstLabelForParent = new List <PopulateComboDTO>();
                    lstLabelForParent.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.CodeParentList,
                                                                              null, arr[1], null, null, null, sLookUpPrefix));

                    ParentLabel = lstLabelForParent.ElementAt <PopulateComboDTO>(0).Value;
                    if (ParentLabel.Contains("Master"))
                    {
                        ParentLabel = ParentLabel.Substring(0, (ParentLabel.Length - 7));
                    }
                    if (CalledFrom == "Details")
                    {
                        ViewBag.ParentCodeName = lstParentCodeGroup;
                        ViewBag.SelectedValue  = "0";
                    }
                    else if (CalledFrom == "List")
                    {
                        ViewBag.ParentCodeName = lstParentCodeGroup;
                    }
                }
                lstCodeGroup = new List <PopulateComboDTO>();
                lstCodeGroup.Add(objPopulateComboDTO);
                lstCodeGroup.AddRange(Common.Common.GetPopulateCombo(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.ComboType.CodeParentList,
                                                                     null, null, null, null, null, sLookUpPrefix));

                objComCodeModel.CodeGroupId = CodeId;


                if (CalledFrom == "Details")
                {
                    ViewBag.ParentLabel       = ParentLabel;
                    ViewBag.CodeGroupDropDown = lstCodeGroup;
                    sView = "PartialCreate";
                }
                else if (CalledFrom == "List")
                {
                    ViewBag.GridType = ConstEnum.GridType.ComCodeList;
                    if (arr[1] != "0")
                    {
                        ViewBag.ParentLabel          = ParentLabel;
                        ViewBag.ParentId             = ParentId;
                        objComCodeModel.ParentCodeId = ParentId;
                        ViewBag.CodeGroupDropDown    = new SelectList(lstCodeGroup, "Key", "Value");
                        sView = "PartialIndex";
                    }
                    else if (ParentId == 0)
                    {
                        ViewBag.AddNew = 1;
                        sView          = "PartialDataGrid";
                    }
                }

                ViewBag.UserAction = acid;
            }
            finally
            {
                objLoginUserDetails = null;

                objPopulateComboDTO = null;

                lstParentCodeGroup = null;
                lstLabelForParent  = null;
                lstCodeGroup       = null;
            }

            return(PartialView(sView, objComCodeModel));
        }
        /// <summary>
        /// Process
        /// </summary>
        /// <returns>info</returns>
        protected override String DoIt()
        {
            log.Info("C_DunningRun_ID=" + _C_DunningRun_ID + ",R_MailText_ID=" + _R_MailText_ID
                     + ", EmailPDF=" + _EMailPDF + ",IsOnlyIfBPBalance=" + _IsOnlyIfBPBalance);

            //	Need to have Template
            if (_EMailPDF && _R_MailText_ID == 0)
            {
                throw new Exception("@NotFound@: @R_MailText_ID@");
            }
            String    subject = "";
            MMailText mText   = null;

            if (_EMailPDF)
            {
                mText = new MMailText(GetCtx(), _R_MailText_ID, Get_TrxName());
                if (_EMailPDF && mText.Get_ID() == 0)
                {
                    throw new Exception("@NotFound@: @R_MailText_ID@ - " + _R_MailText_ID);
                }
                subject = mText.GetMailHeader();
            }
            //
            MDunningRun run = new MDunningRun(GetCtx(), _C_DunningRun_ID, Get_TrxName());

            if (run.Get_ID() == 0)
            {
                throw new Exception("@NotFound@: @C_DunningRun_ID@ - " + _C_DunningRun_ID);
            }
            //	Print Format on Dunning Level
            MDunningLevel level  = new MDunningLevel(GetCtx(), run.GetC_DunningLevel_ID(), Get_TrxName());
            MPrintFormat  format = MPrintFormat.Get(GetCtx(), level.GetDunning_PrintFormat_ID(), false);

            MClient client = MClient.Get(GetCtx());

            int count  = 0;
            int errors = 0;

            MDunningRunEntry[] entries = run.GetEntries(false);
            for (int i = 0; i < entries.Length; i++)
            {
                MDunningRunEntry entry = entries[i];
                if (_IsOnlyIfBPBalance && Env.Signum(entry.GetAmt()) <= 0)
                {
                    continue;
                }
                //	To BPartner
                MBPartner bp = new MBPartner(GetCtx(), entry.GetC_BPartner_ID(), Get_TrxName());
                if (bp.Get_ID() == 0)
                {
                    AddLog(entry.Get_ID(), null, null, "@NotFound@: @C_BPartner_ID@ " + entry.GetC_BPartner_ID());
                    errors++;
                    continue;
                }
                //	To User
                MUser to = new MUser(GetCtx(), entry.GetAD_User_ID(), Get_TrxName());
                if (_EMailPDF)
                {
                    if (to.Get_ID() == 0)
                    {
                        AddLog(entry.Get_ID(), null, null, "@NotFound@: @AD_User_ID@ - " + bp.GetName());
                        errors++;
                        continue;
                    }
                    else if (to.GetEMail() == null || to.GetEMail().Length == 0)
                    {
                        AddLog(entry.Get_ID(), null, null, "@NotFound@: @EMail@ - " + to.GetName());
                        errors++;
                        continue;
                    }
                }
                //	BP Language
                //Language language =Language.getLoginLanguage();		//	Base Language
                Language language = Env.GetLoginLanguage(GetCtx());

                String tableName = "C_Dunning_Header_v";
                if (client.IsMultiLingualDocument())
                {
                    tableName += "t";
                    String AD_Language = bp.GetAD_Language();
                    if (AD_Language != null)
                    {
                        //language =language.getLanguage(AD_Language);
                    }
                }
                // format.SetLanguage(language);
                // format.SetTranslationLanguage(language);
                //	query
                Query query = new Query(tableName);
                query.AddRestriction("C_DunningRunEntry_ID", Query.EQUAL,
                                     entry.GetC_DunningRunEntry_ID());

                //	Engine
                //PrintInfo info = new PrintInfo(
                //    bp.GetName(),
                //    X_C_DunningRunEntry.Table_ID,
                //    entry.GetC_DunningRunEntry_ID(),
                //    entry.GetC_BPartner_ID());
                //info.SetDescription(bp.GetName() + ", Amt=" + entry.GetAmt());
                //ReportEngine re = new ReportEngine(GetCtx(), format, query, info);
                byte[] pdfReport;
                string reportPath = "";

                bool printed = false;
                if (_EMailPDF)
                {
                    EMail email = client.CreateEMail(to.GetEMail(), to.GetName(), null, null);
                    if (email == null || !email.IsValid())
                    {
                        AddLog(entry.Get_ID(), null, null,
                               "@RequestActionEMailError@ Invalid EMail: " + to);
                        errors++;
                        continue;
                    }
                    mText.SetUser(to);  //	variable context
                    mText.SetBPartner(bp);
                    mText.SetPO(entry);
                    String message = mText.GetMailText(true);
                    if (mText.IsHtml())
                    {
                        email.SetMessageHTML(mText.GetMailHeader(), message);
                    }
                    else
                    {
                        email.SetSubject(mText.GetMailHeader());
                        email.SetMessageText(message);
                    }

                    //
                    //File attachment = re.GetPDF(File.createTempFile("Dunning", ".pdf"));
                    //log.Fine(to + " - " + attachment);
                    //email.AddAttachment(attachment);
                    //
                    // Get report that is bound on the dunning entry tab of dunning run window.
                    int ReportProcess_ID = Util.GetValueOfInt(DB.ExecuteScalar("SELECT AD_Process_ID FROM ad_tab WHERE  export_id='VIS_634'"));
                    if (ReportProcess_ID > 0)
                    {
                        Common.Common Com             = new Common.Common();
                        Dictionary <string, object> d = Com.GetReport(GetCtx(), ReportProcess_ID, "C_DunningRunEntry", X_C_DunningRunEntry.Table_ID, entry.GetC_DunningRunEntry_ID(), 0, "", FileType, out pdfReport, out reportPath);
                        if (pdfReport != null)
                        {
                            email.AddAttachment(pdfReport, "Dunning" + entry.GetC_DunningRunEntry_ID() + ".pdf");
                        }
                    }
                    String    msg = email.Send();
                    MUserMail um  = new MUserMail(mText, entry.GetAD_User_ID(), email);
                    um.Save();
                    if (msg.Equals(EMail.SENT_OK))
                    {
                        AddLog(entry.Get_ID(), null, null,
                               bp.GetName() + " @RequestActionEMailOK@");
                        count++;
                        printed = true;
                    }
                    else
                    {
                        AddLog(entry.Get_ID(), null, null,
                               bp.GetName() + " @RequestActionEMailError@ " + msg);
                        errors++;
                    }
                }
                else
                {
                    //re.print();
                    count++;
                    printed = true;
                }
                if (printed)
                {
                    entry.SetProcessed(true);
                    entry.Save();
                    DunningLevelConsequences(level, entry);
                }
            }   //	for all dunning letters
            if (errors == 0)
            {
                run.SetProcessed(true);
                run.Save();
            }

            if (_EMailPDF)
            {
                return("@Sent@=" + count + " - @Errors@=" + errors);
            }
            return("@Printed@=" + count);
        }
예제 #25
0
        public JsonResult Index(DelegateModel objDelegateModel, int acid)
        {
            bool bStatusFlag     = false;
            int  nPatrialSave    = 0;
            var  ErrorDictionary = new Dictionary <string, string>();

            Common.Common    objCommon           = new Common.Common();
            LoginUserDetails objLoginUserDetails = null;

            try
            {
                if (!objCommon.ValidateCSRFForAJAX())
                {
                    return(Json(new
                    {
                        status = false,
                        msg = ErrorDictionary
                    }, JsonRequestBehavior.AllowGet));
                }
                objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

                if (ModelState.IsValid)
                {
                    ViewBag.UserInfoIdFrom        = objDelegateModel.UserInfoIdFrom;
                    ViewBag.UserInfoIdTo          = objDelegateModel.UserInfoIdTo;
                    ViewBag.DelegationFrom        = objDelegateModel.DelegationFrom;
                    ViewBag.DelegationTo          = objDelegateModel.DelegationTo;
                    objDelegateModel.DelegationId = 0;

                    DelegationMasterDTO objDelegationMasterDTO = new DelegationMasterDTO();

                    Common.Common.CopyObjectPropertyByName(objDelegateModel, objDelegationMasterDTO);

                    using (DelegationMasterSL objDelegationMasterSL = new DelegationMasterSL())
                    {
                        objDelegationMasterDTO = objDelegationMasterSL.SaveDetails(objDelegationMasterDTO, nPatrialSave, objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID);
                        bStatusFlag            = true;
                        ErrorDictionary.Add("id", Convert.ToString(objDelegationMasterDTO.DelegationId));
                    }
                }
                else
                {
                    ErrorDictionary = GetModelStateErrorsAsString();
                }
            }catch (Exception e)
            {
                ModelState.Remove("KEY");
                ModelState.Add("KEY", new ModelState());
                ModelState.Clear();
                string sErrMessage = Common.Common.getResource(e.InnerException.Data[0].ToString());
                ModelState.AddModelError("error", sErrMessage);
                ErrorDictionary = GetModelStateErrorsAsString();
            }
            finally
            {
                objLoginUserDetails = null;
            }

            return(Json(new
            {
                status = bStatusFlag,
                msg = ErrorDictionary,
                user_action = acid
            }));
        }
        public JsonResult Create(List <TradingWindowEventModel> tradingWindowEventModel, int nFinancialYearCodeId, int nFinancialPeriodTypeCodeId, int acid, string __RequestVerificationToken, int formId)
        //public JsonResult Create(List<TradingWindowEventModel> tradingWindowEventModel, int nFinancialYearCodeId, int nFinancialPeriodTypeCodeId, int acid)
        {
            bool                 bReturn                 = true;
            LoginUserDetails     objLoginUserDetails     = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);
            TradingWindowEventSL objTradingWindowEventSL = new TradingWindowEventSL();

            Common.Common objCommon = new Common.Common();
            try
            {
                if (!objCommon.ValidateCSRFForAJAX())
                {
                    return(Json(new
                    {
                        status = false,
                        error = ""
                    }, JsonRequestBehavior.AllowGet));
                }
                #region Create Data Table tblTradingWindowEventType
                DataTable tblTradingWindowEventType = new DataTable("TradingWindowEventType");
                tblTradingWindowEventType.Columns.Add(new DataColumn("TradingWindowEventId", typeof(int)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("FinancialYearCodeId", typeof(int)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("FinancialPeriodCodeId", typeof(int)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("TradingWindowId", typeof(string)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("EventTypeCodeId", typeof(int)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("TradingWindowEventCodeId", typeof(int)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("ResultDeclarationDate", typeof(DateTime)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("WindowCloseDate", typeof(DateTime)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("WindowOpenDate", typeof(DateTime)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("DaysPriorToResultDeclaration", typeof(int)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("DaysPostResultDeclaration", typeof(int)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("WindowClosesBeforeHours", typeof(int)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("WindowClosesBeforeMinutes", typeof(int)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("WindowOpensAfterHours", typeof(int)));
                tblTradingWindowEventType.Columns.Add(new DataColumn("WindowOpensAfterMinutes", typeof(int)));
                #endregion Create Data Table tblTradingWindowEventType
                ModelState.Clear();
                foreach (var index in tradingWindowEventModel)
                {
                    DataRow  row = tblTradingWindowEventType.NewRow();
                    DateTime now = Common.Common.GetCurrentDate(objLoginUserDetails.CompanyDBConnectionString);
                    if (index.TradingWindowEventId != null)
                    {
                        row["TradingWindowEventId"] = index.TradingWindowEventId;
                    }

                    row["FinancialYearCodeId"] = nFinancialYearCodeId;

                    if (index.FinancialPeriodCodeId != null)
                    {
                        row["FinancialPeriodCodeId"] = index.FinancialPeriodCodeId;
                    }
                    if (index.TradingWindowId != null)
                    {
                        row["TradingWindowId"] = index.TradingWindowId;
                    }
                    if (index.ResultDeclarationDate != null)
                    {
                        row["ResultDeclarationDate"] = index.ResultDeclarationDate;
                    }
                    else
                    {
                        ModelState.AddModelError("ResultDeclarationDate", "Enter Result Declaration Date");//InsiderTrading.Common.Common.getResource("rul_msg_15083"));
                        bReturn = false;
                    }
                    if (index.WindowOpenDate != null)
                    {
                        row["WindowOpenDate"] = index.WindowOpenDate;
                    }
                    if (index.WindowCloseDate != null)
                    {
                        row["WindowCloseDate"] = index.WindowCloseDate;
                    }
                    if (index.DaysPriorToResultDeclaration != null)
                    {
                        row["DaysPriorToResultDeclaration"] = index.DaysPriorToResultDeclaration;
                    }
                    else
                    {
                        ModelState.AddModelError("DaysPriorToResultDeclaration", "Enter Days Prior To Result Declaration");//InsiderTrading.Common.Common.getResource("rul_msg_15083"));
                        bReturn = false;
                    }
                    if (index.DaysPostResultDeclaration != null)
                    {
                        row["DaysPostResultDeclaration"] = index.DaysPostResultDeclaration;
                    }
                    else
                    {
                        ModelState.AddModelError("DaysPriorToResultDeclaration", "Enter DaysPostResultDeclaration");//InsiderTrading.Common.Common.getResource("rul_msg_15083"));
                        bReturn = false;
                    }
                    if (!bReturn)
                    {
                        break;
                    }
                    tblTradingWindowEventType.Rows.Add(row);
                }
                if (!bReturn && !ModelState.IsValid)
                {
                    return(Json(new { status = false, error = ModelState.ToSerializedDictionary() }));
                }
                bReturn = objTradingWindowEventSL.SaveDetails(objLoginUserDetails.CompanyDBConnectionString, tblTradingWindowEventType, nFinancialPeriodTypeCodeId, objLoginUserDetails.LoggedInUserID);
                // TODO: Add insert logic here
                return(Json(new
                {
                    status = true,
                    Message = Common.Common.getResource("rul_msg_15380")//"Data saved successfully."
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exp)
            {
                string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString());
                ModelState.AddModelError("Error", Common.Common.GetErrorMessage(exp));
                return(Json(new { status = false, error = ModelState.ToSerializedDictionary() }));
            }
            finally
            {
                objLoginUserDetails     = null;
                objTradingWindowEventSL = null;
            }
        }
예제 #27
0
        /// <summary>
        /// Gets the modules.
        /// </summary>
        /// <param name="poeid">The poeid.</param>
        /// <returns></returns>
        public void SignUp(SignupRequest sr)
        {
            //New user
            int    userid      = 0;
            var    user        = sr.User;
            string salt        = CreateSalt();
            string encPassword = CreatePasswordHash(user.Password + salt);

            using (var context = DataContextFactory.GetIntelliSetDataContext())
            {
                if (sr.Mode == 0)
                {
                    var resultuser =
                        context.RegisterUser(user.FirstName + " " + user.LastName, user.Password, encPassword, salt, user.FirstName,
                                             user.LastName, user.EmailAddress, user.CompanyName,
                                             Convert.ToInt32(user.Country.Id), user.Photo, user.YammerToken).FirstOrDefault();
                    if (resultuser != null)
                    {
                        userid = resultuser.UserId.GetValueOrDefault();
                    }

                    sr.User.UserId = userid;
                    SendWelcomeEmail(user.FirstName + " " + user.LastName, user.EmailAddress);
                }
                int subscriptionId = 0;

                var resultsub = context.CreateSubscription(user.EmailAddress, sr.Netwrok.NetworkName, 1, 1, sr.Netwrok.Plan).ToList();
                if (resultsub.Count > 0)
                {
                    subscriptionId = resultsub[0].SubscriptionID.GetValueOrDefault(0);
                }
                if (userid != 0)
                {
                    //subscriptionId = (from c in resultsub let subscriptionID = c.SubscriptionID where subscriptionID != null select subscriptionID.Value).FirstOrDefault();

                    context.UserSubscribtions(subscriptionId, userid, DateTime.Now, 1, 10, 120);
                }

                sr.Netwrok.Subscriptionid = subscriptionId;

                int salesOrderId = 0;
                if (sr.Payment != null)
                {
                    var resultPayment = context.InsertPayment(subscriptionId, sr.Payment.Amount, sr.Payment.Response,
                                                              sr.Payment.ResponseId);
                    if (resultPayment != null)
                    {
                        salesOrderId = resultPayment.FirstOrDefault().SalesOrderId.GetValueOrDefault();
                    }
                }
                //Insert SubscribedPoes
                var common          = new Common.Common();
                var subscriptedPoes = common.GetSubscribedPoes(subscriptionId);
                List <Util.Domain.POE> newlyAddedPoes = sr.Poes;

                if (sr.Poes != null)
                {
                    foreach (var poe in subscriptedPoes)
                    {
                        newlyAddedPoes.RemoveAll(a => a.POEId == poe.POEId);
                    }

                    foreach (Util.Domain.POE poe in sr.Poes)
                    {
                        if (sr.Payment != null)
                        {
                            context.InsertSalesOrderItem(salesOrderId, 1, poe.POEId, poe.Name, 20.00m);
                        }
                        float poecost = 0;
                        if (sr.Members != null)
                        {
                            poecost = sr.Members[0].PoeAmount;
                        }
                        context.InsertSubscribedPoes(poe.POEId, subscriptionId, poecost);
                    }
                }
                if (newlyAddedPoes != null)
                {
                    foreach (var poe in newlyAddedPoes)
                    {
                        SendAddPoeNotificationEmail(user.FirstName + " " + user.LastName, user.EmailAddress, poe.Name);
                    }
                }

                if (sr.Members != null)
                {
                    foreach (UserPOEMapping member in sr.Members)
                    {
                        int    parentMappingid     = 0;
                        int    childMappingId      = 0;
                        int    peerParentMappingid = 0;
                        int    peerchildMappingId  = 0;
                        int    memberid            = 0;
                        string salttemp            = CreateSalt();
                        string encPasswordtemp     = CreatePasswordHash("Pass@123" + salttemp);
                        var    resultmembers       =
                            context.RegisterUser(member.User.FirstName + " " + member.User.LastName, "Pass@123",
                                                 encPasswordtemp, salttemp, member.User.FirstName,
                                                 member.User.LastName, member.User.EmailAddress, user.CompanyName,
                                                 Convert.ToInt32(user.Country.Id), null, member.User.YammerToken).FirstOrDefault();
                        if (member.Designation.Level != (int)NetworkUserFilterType.Customer)
                        {
                            SendInviteEmail(
                                sr.User.FirstName + " " + sr.User.LastName, member.User.FirstName + " " + member.User.LastName, sr.User.EmailAddress, member.User.EmailAddress, subscriptionId);
                        }
                        if (resultmembers != null)
                        {
                            memberid = resultmembers.UserId.GetValueOrDefault();
                            context.UserSubscribtions(subscriptionId, memberid, DateTime.Now, 1, member.Designation.Level, member.UserAmount);
                        }
                        member.User.UserId = memberid;
                        if (member.POE.POEId != 0)
                        {
                            switch (member.Designation.Level)
                            {
                            case (int)NetworkUserFilterType.TeamMember:
                                parentMappingid = InsertPoeMapping(user.UserId, member.POE.POEId, 2, "Manager",
                                                                   sr.Netwrok.Subscriptionid);
                                childMappingId = InsertPoeMapping(member.User.UserId, member.POE.POEId,
                                                                  member.Designation.Level, member.Designation.Name,
                                                                  sr.Netwrok.Subscriptionid);
                                break;

                            case (int)NetworkUserFilterType.Manager:
                                parentMappingid = InsertPoeMapping(member.User.UserId, member.POE.POEId,
                                                                   member.Designation.Level, member.Designation.Name,
                                                                   sr.Netwrok.Subscriptionid);
                                childMappingId = InsertPoeMapping(user.UserId, member.POE.POEId, 1, "Team Member",
                                                                  sr.Netwrok.Subscriptionid);
                                break;

                            case (int)NetworkUserFilterType.SkipLevelManager:
                                parentMappingid = InsertPoeMapping(member.User.UserId, member.POE.POEId,
                                                                   member.Designation.Level, member.Designation.Name,
                                                                   sr.Netwrok.Subscriptionid);
                                childMappingId = InsertPoeMapping(user.UserId, member.POE.POEId, 1, "Team Member",
                                                                  sr.Netwrok.Subscriptionid);
                                break;

                            case (int)NetworkUserFilterType.Customer:
                                parentMappingid = InsertPoeMapping(member.User.UserId, member.POE.POEId,
                                                                   member.Designation.Level, member.Designation.Name,
                                                                   sr.Netwrok.Subscriptionid);
                                childMappingId = InsertPoeMapping(user.UserId, member.POE.POEId, 1, "Team Member",
                                                                  sr.Netwrok.Subscriptionid);
                                break;

                            case (int)NetworkUserFilterType.PeerManager:
                                parentMappingid = InsertPoeMapping(member.User.UserId, member.POE.POEId,
                                                                   (int)NetworkUserFilterType.PeerManager,
                                                                   member.Designation.Name,
                                                                   sr.Netwrok.Subscriptionid);
                                childMappingId = InsertPoeMapping(user.UserId, member.POE.POEId,
                                                                  (int)NetworkUserFilterType.PeerTeam, "Peer Team Member",
                                                                  sr.Netwrok.Subscriptionid);
                                peerParentMappingid = InsertPoeMapping(user.UserId, member.POE.POEId,
                                                                       (int)NetworkUserFilterType.PeerManager, "Peer Manager",
                                                                       sr.Netwrok.Subscriptionid);
                                peerchildMappingId = InsertPoeMapping(member.User.UserId, member.POE.POEId,
                                                                      (int)NetworkUserFilterType.PeerTeam,
                                                                      member.Designation.Name,
                                                                      sr.Netwrok.Subscriptionid);
                                break;
                            }
                        }
                        if (parentMappingid != 0 && childMappingId != 0)
                        {
                            InsertNetworkUsers(parentMappingid, childMappingId, sr.Netwrok.NetworkName, sr.Netwrok.Subscriptionid);
                        }
                        if (peerParentMappingid != 0 && peerchildMappingId != 0)
                        {
                            InsertNetworkUsers(peerParentMappingid, peerchildMappingId, sr.Netwrok.NetworkName, sr.Netwrok.Subscriptionid);
                        }
                        member.ParentMappingId     = parentMappingid;
                        member.ChildMappingId      = childMappingId;
                        member.PeerParentMappingId = peerParentMappingid;
                        member.PeerChildMappingId  = peerchildMappingId;

                        //insert sales order
                        if (sr.Payment != null)
                        {
                            context.InsertSalesOrderItem(salesOrderId, 2, memberid, member.User.EmailAddress, 5.00m);
                        }
                    }
                }
            }
        }
예제 #28
0
        public JsonResult Delete(int acid, int TemplateMasterId)
        {
            bool             statusFlag          = false;
            var              ErrorDictionary     = new Dictionary <string, string>();
            LoginUserDetails objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails);

            Common.Common objCommon = new Common.Common();
            try
            {
                // TemplateMasterSL objTemplateMasterSL = new TemplateMasterSL();
                //TemplateMasterModel objTemplateMasterModel = new TemplateMasterModel();
                if (!objCommon.ValidateCSRFForAJAX())
                {
                    return(Json(new
                    {
                        status = statusFlag,
                        Message = ErrorDictionary
                    }, JsonRequestBehavior.AllowGet));
                }
                using (var objTemplateMasterSL = new TemplateMasterSL())
                {
                    bool result = objTemplateMasterSL.Delete(objLoginUserDetails.CompanyDBConnectionString, TemplateMasterId, objLoginUserDetails.LoggedInUserID);
                }
                // return RedirectToAction("Index", "TemplateMaster",new {acid = ConstEnum.UserActions.TEMPLATE_LIST_RIGHT });
                statusFlag = true;
                ErrorDictionary.Add("success", Common.Common.getResource("tra_msg_16175"));
            }
            catch (Exception exp)
            {
                //string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString());
                //ModelState.AddModelError("Error", sErrMessage);
                TemplateMasterModel     objTemplateMasterModel = new TemplateMasterModel();
                List <PopulateComboDTO> lstList = new List <PopulateComboDTO>();

                lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, ConstEnum.CodeGroup.RoleStatus, null, null, null, null, true);
                ViewBag.TemplateStatus = lstList;

                //get list of communication mode
                lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, ConstEnum.CodeGroup.CommunicationModes, null, null, null, null, true);
                ViewBag.CommunicationMode = lstList;

                //get list of disclousre type
                lstList = FillComboValues(ConstEnum.ComboType.ListOfCode, ConstEnum.CodeGroup.DisclosureType, null, null, null, null, true);
                ViewBag.DisclosureType = lstList;

                lstList = null;
                FillGrid(ConstEnum.GridType.TemplateMasteList, null, null, null);

                // return View("View", objTemplateMasterModel);
                ModelState.Remove("KEY");
                ModelState.Add("KEY", new ModelState());
                ModelState.Clear();
                string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString());
                ModelState.AddModelError("error", sErrMessage);
                ErrorDictionary = GetModelStateErrorsAsString();
            }
            finally
            {
                objLoginUserDetails = null;
            }
            return(Json(new
            {
                status = statusFlag,
                Message = ErrorDictionary
            }, JsonRequestBehavior.AllowGet));
        }
예제 #29
0
        public ActionResult AjaxHandler(String gridtype, String inp_sParam = "", String isInsider = "", int acid = 0, String ClearSearchFilter = "")
        {
            if (ClearSearchFilter == "True")
            {
                TempData.Remove("SearchArray");
                JsonResult returnJson = Json(new
                {
                    status = false
                }, JsonRequestBehavior.AllowGet);
                return(returnJson);
            }
            int                  out_iTotalRecords   = 0;
            String               sLookUpPrefix       = "";
            LoginUserDetails     objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);
            IEnumerable <Object> lstCRUserList       = new List <Object>();
            // Change the received generic object to <key, value> pair as per required for datatable.
            List <Dictionary <string, Object> > lstUserList = new List <Dictionary <string, Object> >();

            Common.Common objCommon = new Common.Common();
            try
            {
                if (!objCommon.ValidateCSRFForAJAX())
                {
                    return(RedirectToAction("Unauthorised", "Home"));
                }

                //Fetch Search parameters
                String   sSearch = Request.Form["Search"];
                String[] arr     = new string[51];
                arr = sSearch.Split(new string[] { "|#|" }, StringSplitOptions.None);
                for (int i = 0; i <= arr.Length - 1; i++)
                {
                    if (arr[i] == "" || arr[i] == "0")
                    {
                        arr[i] = null;
                    }
                }
                if (!IsNullOrEmpty(arr) &&
                    (gridtype == InsiderTrading.Common.ConstEnum.GridType.ContinuousDisclosureListForCO.ToString() ||
                     gridtype == InsiderTrading.Common.ConstEnum.GridType.ContinousDisclosureStatusList.ToString() ||
                     gridtype == InsiderTrading.Common.ConstEnum.GridType.Report_ContinuousReportEmployeeWise.ToString() ||
                     gridtype == InsiderTrading.Common.ConstEnum.GridType.Report_InitialDisclosureEmployeeWise.ToString() ||
                     gridtype == InsiderTrading.Common.ConstEnum.GridType.InitialDisclosureListForCO.ToString() ||
                     gridtype == InsiderTrading.Common.ConstEnum.GridType.COUserList.ToString() ||
                     gridtype == InsiderTrading.Common.ConstEnum.GridType.EmployeeUserList.ToString() ||
                     (gridtype == InsiderTrading.Common.ConstEnum.GridType.RestrictedList.ToString() && arr[8] != "History")))
                {
                    TempData["SearchArray"] = arr;
                    TempData.Keep("SearchArray");
                }
                if (!IsNullOrEmpty(arr) && (gridtype == InsiderTrading.Common.ConstEnum.GridType.Report_ContinuousReportEmployeeIndividual.ToString() ||
                                            gridtype == InsiderTrading.Common.ConstEnum.GridType.Report_InitialDisclosureEmployeeIndividual.ToString()))
                {
                    TempData["ReportSearchArray"] = arr;
                    TempData.Keep("ReportSearchArray");
                }
                //Get sort column, direction, display length and page number
                String sSortCol       = Request.Form["mDataProp_" + Request.Form["iSortCol_0"]];
                String sSortDir       = Request.Form["sSortDir_0"];
                int    nDisplayLength = Convert.ToInt32(Request.Form["iDisplayLength"]);
                int    nPage          = 0;
                if (nDisplayLength != 0)
                {
                    nPage = Convert.ToInt32(Request.Form["iDisplayStart"]) / nDisplayLength + 1;
                }

                using (GenericSLImpl <Object> objGenericSLImpl = new GenericSLImpl <Object>())
                {
                    //PENDING TRANSACTIONS DASHBOARD : Initial Disclosures-Insider
                    if (isInsider == "InitialDisInsider" && inp_sParam == "154002")
                    {
                        //nDisplayLength = 10;

                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    //PENDING TRANSACTIONS DASHBOARD : Initial Disclosures-Insider Relative
                    else if (isInsider == "InitialDisInsider-Relative" && inp_sParam == "154002")
                    {
                        //nDisplayLength = 10;

                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              "1", arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    //PENDING TRANSACTIONS DASHBOARD : Initial Disclosures-CO
                    else if (isInsider == "ContiDisCO" && inp_sParam == "154006")
                    {
                        //nDisplayLength = 10;
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    //PENDING TRANSACTIONS DASHBOARD : Continuous Disclosures-CO
                    else if (isInsider == "ContinouseDisCO" && inp_sParam == "114049")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              arr[6], "153019", arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], "2", arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }

                    //PENDING TRANSACTIONS DASHBOARD : Continuous Disclosures-Insider
                    else if (isInsider == "ContiDisInsider" && inp_sParam == "144001")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              arr[6], "153019", arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], "3", arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    //PENDING TRANSACTIONS DASHBOARD : Period End Disclosures-Insider
                    else if (isInsider == "PeriodEndDisInsider" && inp_sParam == "154002")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              arr[6], inp_sParam, arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    //PENDING TRANSACTIONS DASHBOARD : Period End Disclosures-Insider
                    else if (isInsider == "PeriodEndDisCO")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], "1",
                                                                              arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    //PENDING TRANSACTIONS DASHBOARD : Trade details-Insider
                    else if (isInsider == "TradeDetailsInsider" && inp_sParam == "154002")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], "1", arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    //PENDING TRANSACTIONS DASHBOARD : Trade details-CO
                    else if (isInsider == "TradeDetailsCO" && inp_sParam == "154006")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], "1", arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    //PENDING TRANSACTIONS DASHBOARD : Submission to Stock Exchange-CO
                    else if (isInsider == "SubToStckExCO" && inp_sParam == "154002")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], inp_sParam, arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], "1", arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    //PENDING TRANSACTIONS DASHBOARD : Pre-clearances-CO
                    else if (isInsider == "PreClearancesCO" && inp_sParam == "144001")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], inp_sParam, arr[3], arr[4], arr[5],
                                                                              arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    else if (isInsider == "PreClearancesCO_OS" && inp_sParam == "144001")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], inp_sParam, arr[5],
                                                                              arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    else if (isInsider == "PreClearancesCO_OS" && inp_sParam == "154002")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              inp_sParam, arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    //Defaulter DASHBOARD : Initial, Continouse, Period End, Pre-Clearance
                    else if (inp_sParam == "170001" || inp_sParam == "170002" || inp_sParam == "170003" || inp_sParam == "170004")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], arr[24], inp_sParam, arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    //Defaulter DASHBOARD : Contra Trade
                    else if (inp_sParam == "169007")
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], inp_sParam, arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                    else
                    {
                        lstCRUserList = objGenericSLImpl.ListAllDataTableGrid(objLoginUserDetails.CompanyDBConnectionString, Convert.ToInt32(gridtype), nDisplayLength, nPage,
                                                                              sSortCol, sSortDir, out out_iTotalRecords, sLookUpPrefix, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
                                                                              arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19],
                                                                              arr[20], arr[21], arr[22], arr[23], arr[24], arr[25], arr[26], arr[27], arr[28], arr[29],
                                                                              arr[30], arr[31], arr[32],
                                                                              arr[33], arr[34], arr[35], arr[36], arr[37], arr[38], arr[39], arr[40], arr[41], arr[42], arr[43], arr[44], arr[45], arr[46], arr[47],
                                                                              arr[48], arr[49]
                                                                              );
                    }
                }

                foreach (dynamic objUserList in lstCRUserList)
                {
                    var dictionary = new Dictionary <string, Object>();
                    foreach (KeyValuePair <string, Object> kvp in objUserList) // enumerating over it exposes the Properties and Values as a KeyValuePair
                    {
                        dictionary.Add(kvp.Key, kvp.Value);
                    }
                    lstUserList.Add(dictionary);
                    dictionary = null;
                }
                JsonResult returnJson = Json(new
                {
                    aaData               = lstUserList,
                    status               = true,
                    draw                 = Request.Form["draw"],
                    iTotalRecords        = out_iTotalRecords,
                    iTotalDisplayRecords = out_iTotalRecords
                }, JsonRequestBehavior.AllowGet);
                return(returnJson);
            }
            catch (Exception exp)
            {
                lstUserList = new List <Dictionary <string, Object> >();
                JsonResult returnJson = Json(new
                {
                    aaData               = lstUserList,
                    status               = false,
                    draw                 = Request.Form["draw"],
                    iTotalRecords        = 0,
                    iTotalDisplayRecords = 0
                }, JsonRequestBehavior.AllowGet);
                return(returnJson);
            }
            finally
            {
                lstCRUserList = null;
                lstUserList   = null;
            }
        }
예제 #30
0
        public IList <UserPOEMapping> GetFeedbackGiven(int userId, int subscriptionid)
        {
            //Log("WCF-GetFeedbackGiven-IN");
            var common = new Common.Common();

            using (var context = DataContextFactory.GetIntelliSetDataContext())
            {
                var results = context.GetFeedbackGiven(userId, subscriptionid);
                var outPut  = new List <UserPOEMapping>();
                //foreach (var b in results.GroupBy(item => item.GroupName).ToList())
                //{
                foreach (var a in results)
                {
                    if (a.FeedbackType != null)
                    {
                        var userPoeMapping = new UserPOEMapping
                        {
                            UserPOEMappingId = a.RequestedFor.GetValueOrDefault(),
                            AreaId           = a.ZoneId.GetValueOrDefault(),
                            User             = new User
                            {
                                UserId       = a.UserId.GetValueOrDefault(),
                                FirstName    = a.FirstName,
                                LastName     = a.LastName,
                                EmailAddress = a.EmailID,
                                //      Photo = a.Photo,

                                Country = new Country
                                {
                                    Id   = a.CountryId.GetValueOrDefault(),
                                    Name = Helper.GetCountryName(a.CountryId.GetValueOrDefault())
                                },
                                Area = new Zone
                                {
                                    Id   = a.ZoneId.GetValueOrDefault(),
                                    Name = Helper.GetAreaById(a.ZoneId.GetValueOrDefault())
                                }
                            },
                            POE = new Util.Domain.POE()
                            {
                                POEId = a.POEId.GetValueOrDefault(),
                                Name  = a.POEName,
                            },
                            Designation = new Designation
                            {
                                DesignationId = a.DesignationId.GetValueOrDefault(),
                                Name          = a.JobTitle,
                            },
                            FeedbackDetails = new Feedback
                            {
                                FeedbackId  = a.GroupName != null ? 0 : a.POEFeedbackId.GetValueOrDefault(),
                                RequestedBy =
                                    common.GetUserDetailsByMappingId(a.RequestedBy.GetValueOrDefault()),
                                RequestedFor =
                                    common.GetUserDetailsByMappingId(a.RequestedFor.GetValueOrDefault()),
                                RequestedFrom =
                                    common.GetUserDetailsByMappingId(a.RequestedFrom.GetValueOrDefault()),
                                RequestedById   = a.RequestedBy.GetValueOrDefault(),
                                RequestedForId  = a.RequestedFor.GetValueOrDefault(),
                                RequestedFromId = a.RequestedFrom.GetValueOrDefault(),
                                CreatedOnDtm    = a.CreatedOn.GetValueOrDefault(),
                                UpdatedOnDtm    = a.UpdatedOn.GetValueOrDefault(),
                                CreatedOn       =
                                    a.CreatedOn != null
                                        ? a.CreatedOn.GetValueOrDefault().ToString("MMMM dd, yyyy")
                                        : "",
                                UpdatedOn =
                                    a.UpdatedOn != null
                                        ? a.UpdatedOn.GetValueOrDefault().ToString("MMMM dd, yyyy")
                                        : "",
                                FeedbackStatus =
                                    (FeedbackStatus)
                                    Enum.Parse(typeof(FeedbackStatus),
                                               a.FeedbackStatus.GetValueOrDefault().ToString()),
                                FeedbackType =
                                    (FeedbackType)
                                    Enum.Parse(typeof(FeedbackType), a.FeedbackType.Value.ToString(CultureInfo.InvariantCulture)),
                                GroupName = a.GroupName
                            },

                            JobTitle = a.JobTitle
                        };
                        outPut.Add(userPoeMapping);

                        //if (userPoeMapping.FeedbackDetails.GroupName != null)
                        //{
                        //    userPoeMapping.Nooffbs = 1;
                        //    break;
                        //}
                    }
                }
                //}
                // Log("WCF-GetFeedbackGiven-OUT");
                return(outPut);
            }
        }
예제 #31
0
        public JsonResult UpdateResourceValue(ResourceModel objResourceModel, int acid)
        {
            bool             bReturn             = false;
            LoginUserDetails objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails);
            ResourcesSL      objResourcesSL      = new ResourcesSL();
            ResourcesDTO     objResourcesDTO     = new ResourcesDTO();
            CompaniesSL      objCompaniesSL      = new CompaniesSL();
            bool             statusFlag          = false;
            var ErrorDictionary = new Dictionary <string, string>();

            Common.Common objCommon = new Common.Common();
            string        message   = string.Empty;

            try
            {
                if (!objCommon.ValidateCSRFForAJAX())
                {
                    return(Json(new
                    {
                        status = statusFlag,
                        Message = ErrorDictionary
                    }, JsonRequestBehavior.AllowGet));
                }
                Common.Common.CopyObjectPropertyByName(objResourceModel, objResourcesDTO);
                objResourcesDTO.LoggedInUserId = objLoginUserDetails.LoggedInUserID;
                bReturn = objResourcesSL.SaveDetails(objLoginUserDetails.CompanyDBConnectionString, objResourcesDTO);
                if (bReturn)
                {
                    objCompaniesSL.UpdateMasterCompanyDetails(Common.Common.getSystemConnectionString(), objLoginUserDetails.CompanyName, 1);
                    Common.Common.UpdateCompanyResources(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.CompanyName);
                    //return Json(new
                    //{
                    //    status = true,
                    //    Message = InsiderTrading.Common.Common.getResource("mst_msg_10049") //"Resource Update Successfully."

                    //}, JsonRequestBehavior.AllowGet);
                    statusFlag = true;
                    message    = InsiderTrading.Common.Common.getResource("mst_msg_10049");
                }
                else
                {
                    statusFlag = false;
                    message    = "Resource not saved.";
                }
                //return Json(new
                //{
                //    status = false,
                //    Message = "Resource not saved."

                //}, JsonRequestBehavior.AllowGet);
            }
            catch (Exception exp)
            {
                ModelState.Remove("KEY");
                ModelState.Add("KEY", new ModelState());
                ModelState.Clear();
                string sErrMessage = Common.Common.getResource(exp.InnerException.Data[0].ToString());
                ModelState.AddModelError("error", sErrMessage);
                ErrorDictionary = GetModelStateErrorsAsString();
            }
            finally
            {
                objLoginUserDetails = null;
                objResourcesSL      = null;
                objResourcesDTO     = null;
                objCompaniesSL      = null;
            }
            return(Json(new
            {
                status = statusFlag,
                Message = message
            }, JsonRequestBehavior.AllowGet));
        }