Exemple #1
0
        public List <string> GetAllActiveEmpId(string prefixText, int count, string contextKey)
        {
            try
            {
                _objCompanySetup           = new CompanySetup();
                _objCompanySetup.CompanyID = Convert.ToInt32(contextKey);
                List <string> ItemList   = new List <string>();
                DataTable     dtEmployee = new DataTable();
                string        sqlString  = "";
                if (prefixText == "*")
                {
                    sqlString = "SELECT EmployeeID FROM [hrEmployeeSetup] WHERE DataUsed = 'A' ORDER BY EmployeeID";
                }
                else
                {
                    sqlString = "SELECT EmployeeID FROM [hrEmployeeSetup] WHERE (EmployeeID like '%" + prefixText + "%'  or (FullName like '%" + prefixText + "%')) AND DataUsed = 'A' ORDER BY EmployeeID";
                }

                dtEmployee = clsDataManipulation.GetData(_connectionString, sqlString);
                foreach (DataRow dr in dtEmployee.Rows)
                {
                    ItemList.Add(dr["EmployeeID"].ToString());
                }
                return(ItemList);
            }
            catch (Exception msgException)
            {
                throw msgException;
            }
        }
        private void ShowNodesOfRole()
        {
            try
            {
                _objUserPermission           = new UserPermission();
                _objUserPermission.RoleID    = Convert.ToInt32(Session["selectedRoleID"].ToString());
                _objCompanySetup             = new CompanySetup();
                _objCompanySetup.CompanyID   = LoginUserInformation.CompanyID;
                _objUserPermissionController = new UserPermissionController();
                DataTable dtNodes = _objUserPermissionController.GetNodesOfRole(_objCompanySetup, _objUserPermission);
                while (TreeViewAllNode.CheckedNodes.Count > 0)
                {
                    TreeViewAllNode.CheckedNodes[0].Checked = false;
                }

                foreach (DataRow rowNo in dtNodes.Rows)
                {
                    foreach (TreeNode nodeNumber in this.TreeViewAllNode.Nodes)
                    {
                        ShowNodeInRole(nodeNumber, rowNo["NodeID"].ToString());
                    }
                }
            }
            catch (Exception msgException)
            {
                throw msgException;
            }
        }
        internal void SaveRoleData(CompanySetup objCompanySetup, UserPermission objUserPermission)
        {
            try
            {
                objUserPermission.RoleID = GetRoleID();
                var storedProcedureComandText = "INSERT INTO [uRoleSetup] ([CompanyID],[RoleID],[RoleTypeID],[RoleName],[DataUsed],[EntryUserID],[EntryDate]) VALUES ( " +
                                                objCompanySetup.CompanyID + "," +
                                                objUserPermission.RoleID + ",'" +
                                                objUserPermission.RoleType + "','" +
                                                objUserPermission.RoleName + "','" +
                                                "A" + "', '" +
                                                objCompanySetup.EntryUserName + "'," +
                                                "CAST(GETDATE() AS DateTime));";
                clsDataManipulation.StoredProcedureExecuteNonQuery(this.ConnectionString, storedProcedureComandText);

                foreach (var itemNo in objUserPermission.nodeList)
                {
                    objUserPermission.NodeID = Convert.ToInt32(itemNo.ToString());
                    var storedProcedureComandTextNode = "INSERT INTO [uRoleSetupDetails] ([RoleID],[NodeID],[DataUsed],[EntryUserID],[EntryDate]) VALUES ( " +
                                                        objUserPermission.RoleID + "," +
                                                        objUserPermission.NodeID + ",'" +
                                                        "A" + "', '" +
                                                        objCompanySetup.EntryUserName + "'," +
                                                        "CAST(GETDATE() AS DateTime));";
                    clsDataManipulation.StoredProcedureExecuteNonQuery(this.ConnectionString, storedProcedureComandTextNode);
                }
            }
            catch (Exception msgException)
            {
                throw msgException;
            }
        }
Exemple #4
0
        public string SQLGetAllSuppliers(CompanySetup objCompanySetup, BranchSetup objBranchSetup)
        {
            string sqlString = null;

            sqlString = "SELECT ContactID,FullName FROM [AllSuppliers] WHERE CompanyID = " + objCompanySetup.CompanyID + " AND BranchID = " + objBranchSetup.BranchID + " ORDER BY FullName";
            return(sqlString);
        }
 private void SendSecurityCodeByMail(CompanySetup objCompanySetup, UserSecurityCode objUserSecurityCode)
 {
     try
     {
         objUserSecurityCode.SecurityCode = GetSecurityCode(objCompanySetup, objUserSecurityCode);
         if (objUserSecurityCode.SecurityCode != 0)
         {
             MailServiceSetup objMailServiceSetup = new MailServiceSetup();
             objMailServiceSetup.MailBody = "Your security code is: " + objUserSecurityCode.SecurityCode + "";
             EmployeeInformationController objEmployeeInformationController = new EmployeeInformationController();
             EmployeeSetup objEmployeeSetup = new EmployeeSetup();
             objEmployeeSetup.EmployeeID    = objUserSecurityCode.UserKnownID;
             objEmployeeSetup.CompanyID     = objCompanySetup.CompanyID;
             objMailServiceSetup.EmailTo    = objEmployeeInformationController.GetEmployeeEmail(objEmployeeSetup);
             objMailServiceSetup.MailtypeID = "1";
             ArrayList attachDocument = new ArrayList();
             objMailServiceSetup.AttachItem = attachDocument;
             MailServiceController objMailServiceController = new MailServiceController();
             objMailServiceController.eMailSendService(objCompanySetup, objMailServiceSetup);
         }
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
        internal void UpdateRoleData(CompanySetup objCompanySetup, UserPermission objUserPermission)
        {
            try
            {
                string sqlForUpdate = @"UPDATE [uRoleSetup] SET [RoleName] = '" + objUserPermission.RoleName + "',[LastUpdateDate] = CAST(GETDATE() AS DateTime)," +
                                      "[LastUpdateUserID] = '" + objCompanySetup.EntryUserName + "' WHERE [CompanyID] = " + objCompanySetup.CompanyID + " AND " +
                                      " [RoleID] = 1 AND [RoleTypeID] = '" + objUserPermission.RoleType + "'; " +
                                      " DELETE FROM uRoleSetupDetails WHERE RoleID = " + objUserPermission.RoleID + "";
                clsDataManipulation.StoredProcedureExecuteNonQuery(this.ConnectionString, sqlForUpdate);

                foreach (var itemNo in objUserPermission.nodeList)
                {
                    objUserPermission.NodeID = Convert.ToInt32(itemNo.ToString());
                    var storedProcedureComandTextNode = "INSERT INTO [uRoleSetupDetails] ([RoleID],[NodeID],[DataUsed],[EntryUserID],[EntryDate]) VALUES ( " +
                                                        objUserPermission.RoleID + "," +
                                                        objUserPermission.NodeID + ",'" +
                                                        "A" + "', '" +
                                                        objCompanySetup.EntryUserName + "'," +
                                                        "CAST(GETDATE() AS DateTime));";
                    clsDataManipulation.StoredProcedureExecuteNonQuery(this.ConnectionString, storedProcedureComandTextNode);
                }
            }
            catch (Exception msgException)
            {
                throw msgException;
            }
        }
Exemple #7
0
        public string Save(CompanySetup companySetup)

        {
            if (companySetupGateway.IsCompanyNameExists(companySetup.CompanyName))
            {
                return("Company Name Already Exists");
            }
            else if (companySetup.CompanyName == "")
            {
                return("WARNING !! Null field should be filled.");
            }


            else
            {
                int rowAffect = companySetupGateway.Save(companySetup);


                if (rowAffect > 0)
                {
                    return("Company Name Entry Successful");
                }
                else
                {
                    return("Company name save Failed");
                }
            }
        }
        private void AddValuesForRoleSetup()
        {
            try
            {
                _objUserPermission             = new UserPermission();
                _objCompanySetup               = new CompanySetup();
                _objCompanySetup.CompanyID     = LoginUserInformation.CompanyID;
                _objCompanySetup.EntryUserName = LoginUserInformation.UserID;
                _objUserPermission.RoleName    = txtRoleTitle.Text == string.Empty ? null : txtRoleTitle.Text;

                foreach (TreeNode nodeNumber in this.TreeViewAllNode.Nodes)
                {
                    saveNodePermission(nodeNumber);
                }

                _objUserPermission.nodeList = listNode;

                _objUserPermission.RoleType  = ddlRoleType.SelectedValue == "-1" ? null : ddlRoleType.SelectedValue;
                _objUserPermissionController = new UserPermissionController();
                if (btnRoleSave.Text == "Save")
                {
                    _objUserPermissionController.SaveRoleData(_objCompanySetup, _objUserPermission);
                }
                else
                {
                    _objUserPermission.RoleID = Convert.ToInt32(Session["selectedRoleID"].ToString());
                    _objUserPermissionController.UpdateRoleData(_objCompanySetup, _objUserPermission);
                }
            }
            catch (Exception msgException)
            {
                throw msgException;
            }
        }
        public static CompanySetupVm GetCompanySetup()
        {
            CompanySetupVm      compSetVm          = new CompanySetupVm();
            EasyFreightEntities db                 = new EasyFreightEntities();
            CompanySetup        compSetupDb        = db.CompanySetups.FirstOrDefault();
            CompanySetupContact compSetupContactDb = db.CompanySetupContacts.FirstOrDefault();

            //     SystemSetup sysSetupDb = db.SystemSetups.FirstOrDefault();

            if (compSetupDb != null)
            {
                Mapper.CreateMap <CompanySetup, CompanySetupVm>();
                Mapper.Map(compSetupDb, compSetVm);
            }

            if (compSetupContactDb != null)
            {
                Mapper.CreateMap <CompanySetupContact, CompanySetupVm>();
                Mapper.Map(compSetupContactDb, compSetVm);
            }

            //if (sysSetupDb != null)
            //{
            //    Mapper.CreateMap<SystemSetup, CompanySetupVm>();
            //    Mapper.Map(sysSetupDb, compSetVm);
            //}


            return(compSetVm);
        }
Exemple #10
0
        protected void saveCompanyNameButton_Click(object sender, EventArgs e)
        {
            string intCheck = saveCompanyNameTextBox.Text;
            int    count = 0, z = 0;

            for (int i = 0; i < intCheck.Length; i++)
            {
                if ((intCheck[i] >= '0' && intCheck[i] <= '9'))
                {
                    count++;
                }
                if ((intCheck[i] >= 'a' && intCheck[i] <= 'z') || (intCheck[i] >= 'A' && intCheck[i] <= 'Z'))
                {
                    z++;
                }
            }
            if (count > 0 || z == 0)
            {
                outputLabel.Text            = "Number (0-9) and special characters (@,#,$..) are not allowed! ";
                saveCompanyNameTextBox.Text = "";
            }
            else
            {
                CompanySetup companySetup = new CompanySetup();
                companySetup.CompanyName    = saveCompanyNameTextBox.Text;
                outputLabel.Text            = companySetupManager.Save(companySetup);
                saveCompanyNameTextBox.Text = "";

                companySetupGridView.DataSource = companySetupManager.GetAllCompanySetup();
                companySetupGridView.DataBind();
            }
        }
        private void setupCompanyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            CompanySetup company = new CompanySetup();

            company.Show();
        }
        public async Task UpdateCompanySetupAsync(string company, CompanySetup companySetup)
        {
            var queryParameters = new DynamicParameters();
            queryParameters.Add("@CompanyId", companySetup.CompanyId);
            queryParameters.Add("@Description", companySetup.CompanyName);
            queryParameters.Add("@DefaultBrokerId", companySetup.DefaultBrokerId);
            queryParameters.Add("@FunctionalCurrencyCode", companySetup.FunctionalCurrencyCode);
            queryParameters.Add("@StatutoryCurrencyCode", companySetup.StatutoryCurrencyCode);
            queryParameters.Add("@DefaultBankAccountId", null);
            queryParameters.Add("@ActiveDate", companySetup.CompanyDate);
            queryParameters.Add("@TimeZoneName", companySetup.TimeZone);
            queryParameters.Add("@CounterpartyId", companySetup.CounterpartyId);
            queryParameters.Add("@IsLocked", null);
            queryParameters.Add("@PriceUnitId", companySetup.PriceUnitId);
            queryParameters.Add("@WeightUnitId", companySetup.WeightUnitId);
            queryParameters.Add("@CountryId", companySetup.CountryId);
            queryParameters.Add("@LdcRegionId", companySetup.LDCRegionId);
            queryParameters.Add("@CompanyTypeId", companySetup.CompanyTypeId);
            queryParameters.Add("@CompanyPlatformId", companySetup.CompanyPlatformId);
            queryParameters.Add("@CropYearId", companySetup.CropYearFormatId);
            queryParameters.Add("@LegalEntity", companySetup.LegalEntity);
            queryParameters.Add("@LegalEntityCode", companySetup.LegalEntityCode);
            queryParameters.Add("@CompanyFriendlyCode", companySetup.CompanyFriendlyCode);
            queryParameters.Add("@DefaultProvinceId", companySetup.DefaultProvinceId);
            queryParameters.Add("@DefaultBranchId", companySetup.DefaultBranchId);
            queryParameters.Add("@IsProvinceEnable", companySetup.IsProvinceEnable);

            await ExecuteNonQueryAsync(StoredProcedureNames.UpdateCompany, queryParameters, true);
        }
        public string ItemTypeSql(CompanySetup objCompanySetup, BranchSetup objBranchSetup)
        {
            string sqlString = null;

            sqlString = "SELECT ItemTypeID,ItemType FROM matItemTypeSetup WHERE DataUsed = 'A' AND CompanyID = '" + objCompanySetup.CompanyID + "' AND BranchID = '" + objBranchSetup.BranchID + "' ORDER BY ItemType";
            return(sqlString);
        }
        public string UnitSql(CompanySetup objCompanySetup, BranchSetup objBranchSetup)
        {
            string sqlString = null;

            sqlString = "SELECT UnitID,Unit FROM matUnitSetup WHERE DataUsed = 'A' AND CompanyID = '" + objCompanySetup.CompanyID + "' AND BranchID = '" + objBranchSetup.BranchID + "' ORDER BY Unit";
            return(sqlString);
        }
Exemple #15
0
        public static CompanyInfoVm GetCompInfo()
        {
            CompanyInfoVm       compInfo    = new CompanyInfoVm();
            EasyFreightEntities db          = new EasyFreightEntities();
            CompanySetup        compSetupDb = db.CompanySetups.FirstOrDefault();

            Mapper.CreateMap <CompanySetup, CompanyInfoVm>();
            Mapper.Map(compSetupDb, compInfo);
            return(compInfo);
        }
Exemple #16
0
 internal void LoadRelatedUserRoleLB(ListBox givenListBoxID, CompanySetup objCompanySetup)
 {
     try
     {
         ClsListBoxController.LoadListBox(this.ConnectionString, this.SqlForRelatedUserRole(objCompanySetup), givenListBoxID, "RelatedToText", "RelatedToID");
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
 internal void GetRoleRecord(CompanySetup objCompanySetup, UserPermission objUserPermission, ListBox targetListBox)
 {
     try
     {
         ClsListBoxController.LoadListBox(this.ConnectionString, this.SQLGetRoleRecord(objCompanySetup, objUserPermission), targetListBox, "RoleName", "RoleID");
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
Exemple #18
0
 internal void LoadRelatedUserRoleDDL(DropDownList ddlRelatedUserRoleID, CompanySetup objCompanySetup)
 {
     try
     {
         ClsDropDownListController.LoadDropDownList(this.ConnectionString, this.SqlForRelatedUserRole(objCompanySetup), ddlRelatedUserRoleID, "RelatedToText", "RelatedToID");
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
 internal void LoadRelatedUserRoleLB(ListBox ListBoxRelatedUserRole, CompanySetup _objCompanySetup)
 {
     try
     {
         TwoColumnTablesController objTwoColumnTablesController = new TwoColumnTablesController();
         objTwoColumnTablesController.LoadRelatedUserRoleLB(ListBoxRelatedUserRole, _objCompanySetup);
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
 internal void LoadVehicleBodyTypeDDL(DropDownList givenDDLID, CompanySetup objCompanySetup)
 {
     try
     {
         _objTwoColumnsTableData.TableName = "VehicleBodyType";
         ClsDropDownListController.LoadDropDownList(this.ConnectionString, this.SqlVehicleProperty(objCompanySetup), givenDDLID, "FieldOfName", "FieldOfID");
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
 internal void SendSecurityCode(CompanySetup objCompanySetup, UserSecurityCode objUserSecurityCode)
 {
     try
     {
         Save(objCompanySetup, objUserSecurityCode);
         SendSecurityCodeByMail(objCompanySetup, objUserSecurityCode);
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
 internal void LoadBranchDDL(DropDownList ddlBranch, CompanySetup objCompanySetup)
 {
     try
     {
         _objOrganizationalChartSetupController = new OrganizationalChartSetupController();
         _objOrganizationalChartSetupController.LoadBranchDDL(ddlBranch, objCompanySetup);
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
Exemple #23
0
 private string SqlForRelatedUserRole(CompanySetup objCompanySetup)
 {
     try
     {
         string sqlString = null;
         sqlString = " SELECT [RelatedToID],[RelatedToText]  FROM [sysRelatedUserRole] WHERE CompanyID = " + objCompanySetup.CompanyID + " ORDER BY [RelatedToText]";
         return(sqlString);
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
Exemple #24
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            CompanySetup aCompanySetup = new CompanySetup();

            aCompanySetup.Name = companyNameTextBox.Text;

            string message = companySetupManager.Save(aCompanySetup);

            outputLabel.Text               = message;
            companyNameTextBox.Text        = "";
            companyListGridView.DataSource = companySetupManager.GetAllCompanySetup();
            companyListGridView.DataBind();
        }
 internal void LoadBranchDDL(DropDownList givenDDLID, CompanySetup objCompanySetup)
 {
     try
     {
         _objTwoColumnsTableData.TableName = "[orgBranch]";
         SectionSetup objSectionSetup = new SectionSetup();
         objSectionSetup.CompanyID = objCompanySetup.CompanyID;
         ClsDropDownListController.LoadDropDownList(this.ConnectionString, this.SqlOrgDepartment(objSectionSetup), givenDDLID, "EntityName", "EntityID");
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
 private int GetSecurityCode(CompanySetup objCompanySetup, UserSecurityCode objUserSecurityCode)
 {
     try
     {
         string sql = "SELECT [SecurityCode] FROM [UserSecurityCode] WHERE DataUsed = 'A' AND SecurityCodeStatus = 0 AND [CompanyID]= " + objCompanySetup.CompanyID + " AND [EmployeeID] = '" + objUserSecurityCode.UserKnownID + "'";
         clsDataManipulation objclsDataManipulation = new clsDataManipulation();
         objUserSecurityCode.SecurityCode = objclsDataManipulation.GetSingleValue(this.ConnectionString, sql);
         return(objUserSecurityCode.SecurityCode);
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         _objCompanySetup               = new CompanySetup();
         _objCompanySetup.CompanyID     = LoginUserInformation.CompanyID;
         _objUserSecurityCodeController = new UserSecurityCodeController();
         _objUserSecurityCodeController.LoadUserForSecurityCode(_objCompanySetup, GridViewUsers);
     }
     catch (Exception msgException)
     {
         clsTopMostMessageBox.Show(msgException.Message);
     }
 }
Exemple #28
0
        public int Save(CompanySetup companySetup)

        {
            string query = "INSERT INTO CompanySetup VALUES('" + companySetup.CompanyName + "')";

            Command = new SqlCommand(query, Connection);

            Connection.Open();
            int rowAffect = Command.ExecuteNonQuery();

            Connection.Close();

            return(rowAffect);
        }
 private string SqlVehicleProperty(CompanySetup objCompanySetup)
 {
     try
     {
         string sqlString = null;
         sqlString = @"SELECT [FieldOfID]
                   ,[FieldOfName]
               FROM " + _objTwoColumnsTableData.TableName + " WHERE DataUsed = 'A' AND CompanyID = " + objCompanySetup.CompanyID + " ORDER BY FieldOfName  ";
         return(sqlString);
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }
 private void Save(CompanySetup objCompanySetup, UserSecurityCode objUserSecurityCode)
 {
     try
     {
         var storedProcedureComandText = "exec [spInitiateSecurityCode] " +
                                         objCompanySetup.CompanyID + ",'" +
                                         objUserSecurityCode.UserKnownID + "','" +
                                         objCompanySetup.EntryUserName + "'";
         clsDataManipulation.StoredProcedureExecuteNonQuery(this.ConnectionString, storedProcedureComandText);
     }
     catch (Exception msgException)
     {
         throw msgException;
     }
 }