/// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int UpdateOrganogram(CmnOrganogram model)
        {
            GenericFactoryFor_Organogram = new vmCmnOrganogram_GF();
            int result = 0;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("OrganogramID", model.OrganogramID);
                ht.Add("CustomCode", model.CustomCode);
                ht.Add("OrganogramName", model.OrganogramName);
                ht.Add("ParentID", model.ParentID);
                //ht.Add("IsCostCenter", model.IsCostCenter);
                //ht.Add("IsDefault", model.IsDefault);
                //ht.Add("StatusID", model.StatusID);
                ht.Add("CompanyID", model.CompanyID);
                ht.Add("CreateBy", model.CreateBy);
                ht.Add("CreateOn", DateTime.Now);
                ht.Add("CreatePc", HostService.GetIP());
                ht.Add("UpdateBy", 1);
                ht.Add("UpdateOn", DateTime.Now);
                ht.Add("UpdatePc", HostService.GetIP());
                ht.Add("IsDeleted", model.IsDeleted);
                ht.Add("DeleteBy", model.DeleteBy);
                ht.Add("DeleteOn", model.DeleteOn);
                ht.Add("DeletePc", model.DeletePc);
                string spQuery = "[Put_CmnOrganogram]";
                result = GenericFactoryFor_Organogram.ExecuteCommand(spQuery, ht);
            }
            catch (Exception e)
            {
                e.ToString();
            }
            return(result);
        }
示例#2
0
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through ORM</para>
        /// </summary>
        public int SaveStockEntry(InvStockMaster model)
        {
            GenericFactory_EF_StockItems = new InvStockMaster_GF();
            int       result  = 0;
            string    spQuery = "";
            Hashtable ht      = new Hashtable();

            try
            {
                model.CreateOn  = DateTime.Today;
                model.CreatePc  = HostService.GetIP();
                model.IsDeleted = false;

                ht.Add("ItemID", model.ItemID);
                ht.Add("GradeID", model.GradeID);
                ht.Add("Qty", model.ReceiveQty);
                ht.Add("CompanyID", model.CompanyID);

                spQuery = "[Put_CmnInvStockMaster]";
                result  = GenericFactory_EF_StockItems.ExecuteCommand(spQuery, ht);
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            return(result);
        }
示例#3
0
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int UpdateUserGroup(vmUserGroup model)
        {
            int result = 0;

            try
            {
                if (model != null)
                {
                    using (GenericFactoryFor_UserGroup = new vmUserGroup_GF())
                    {
                        Hashtable ht = new Hashtable();
                        ht.Add("CompanyID", model.CompanyID);
                        ht.Add("LoggedUser", model.LoggedUser);

                        ht.Add("UserGroupID", model.UserGroupID);
                        ht.Add("GroupName", model.GroupName);
                        ht.Add("Sequence", model.Sequence);

                        string spQuery = "[Put_CmnUserGroup]";
                        result = GenericFactoryFor_UserGroup.ExecuteCommand(spQuery, ht);
                    }
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }

            return(result);
        }
示例#4
0
        /// <summary>
        /// Update Delete From Database
        /// <para>Use it when delete data through a stored procedure</para>
        /// </summary>
        public int DeleteUserType(int?id, int?CompanyID, int?LoggedUser)
        {
            int result = 0;

            try
            {
                if ((id > 0) && (CompanyID > 0))
                {
                    using (GenericFactoryFor_UserType = new vmUserType_GF())
                    {
                        Hashtable ht = new Hashtable();
                        ht.Add("CompanyID", CompanyID);
                        ht.Add("LoggedUser", LoggedUser);

                        ht.Add("UserTypeID", id);

                        string spQuery = "[Delete_CmnUserType]";
                        result = GenericFactoryFor_UserType.ExecuteCommand(spQuery, ht);
                    }
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }

            return(result);
        }
示例#5
0
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int UpdateUserType(vmUserType model)
        {
            int result = 0;

            try
            {
                if (model != null)
                {
                    using (GenericFactoryFor_UserType = new vmUserType_GF())
                    {
                        Hashtable ht = new Hashtable();
                        ht.Add("CompanyID", model.CompanyID);
                        ht.Add("LoggedUser", model.LoggedUser);

                        ht.Add("UserTypeID", model.UserTypeID);
                        ht.Add("UserTypeName", model.UserTypeName);
                        ht.Add("ParentID", model.ParentID);

                        string spQuery = "[Put_CmnUserType]";
                        result = GenericFactoryFor_UserType.ExecuteCommand(spQuery, ht);
                    }
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }

            return(result);
        }
示例#6
0
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int UpdateCompany(CmnCompany model, UserCommonEntity commonEntity)
        {
            GenericFactoryFor_Company = new CmnCompany_GF();
            int result = 0;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("CompanyID", model.CompanyID);
                ht.Add("CustomCode", model.CustomCode);
                ht.Add("CompanyShortName", model.CompanyShortName);
                ht.Add("CompanyName", model.CompanyName);
                ht.Add("LoggedCompanyID", commonEntity.loggedCompnyID);
                ht.Add("LoggedUser", commonEntity.loggedUserID);
                string spQuery = "[Put_CmnCompany]";
                result = GenericFactoryFor_Company.ExecuteCommand(spQuery, ht);
            }
            catch (Exception ex)
            {
                ErrorLog.Log(ex);
                ex.ToString();
            }

            return(result);
        }
示例#7
0
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int SaveEmployee(EmpMaster model)
        {
            int result = 0;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("EmpName", model.EmpName);

                string spQuery = "[Set_Customer]";
                result = GenericFactoryFor_Emp.ExecuteCommand(spQuery, ht);
            }
            catch (Exception e)
            {
                e.ToString();
            }

            return(result);
        }
示例#8
0
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int SaveCustomer(tbl_Customer model)
        {
            int result = 0;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("Name", model.Name);
                ht.Add("Email", model.Email);
                ht.Add("Mobile", model.Mobile);

                string spQuery = "[Set_Customer]";
                result = GenericFactoryFor_Customer.ExecuteCommand(spQuery, ht);
            }
            catch (Exception e)
            {
                e.ToString();
            }

            return(result);
        }
示例#9
0
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int SaveCompany(CmnCompany model)
        {
            GenericFactoryEF_Company  = new CmnCompany_EF();
            GFactory_EF_CmnCustomCode = new SalCmnCustomCode_EF();

            int result = 0;

            try
            {
                #region CustomCode And Primary Key  Process
                int NextId = Convert.ToInt16(GenericFactoryEF_Company.getMaxID("CmnCompany"));
                model.CompanyID = NextId;
                //......... START for custom code........... //
                //string customCode = "";
                CmnCustomCode objCustomCode = GFactory_EF_CmnCustomCode.FindBy(m => m.MenuID == model.MenuID && m.IsDeleted == false).FirstOrDefault();
                //int customCodeID = Convert.ToInt16(objCustomCode.RecordID);
                //if (customCodeID > 0)
                //{
                //  //  customCode = GenericFactory_EF_SalPIMaster.getCustomCode(customCodeID, DateTime.Now, itemMaster.CompanyID, 1, 1);
                //    customCode = GFactory_EF_CmnCustomCode.getCustomCode(customCodeID, DateTime.Now, 0, 1, 1);
                //}
                //else
                //{
                //    customCode = NextId.ToString();
                //}
                //.........END for custom code............ //

                #endregion CustomCode And Primary Key  Process
                Hashtable ht = new Hashtable();
                ht.Add("CompanyID", model.CompanyID);
                ht.Add("CustomCode", model.CustomCode);
                ht.Add("CompanyShortName", model.CompanyShortName);
                ht.Add("CompanyName", model.CompanyName);
                //ht.Add("StatusID", model.StatusID);
                string spQuery = "[Set_CmnCompany]";
                result = GenericFactoryFor_Company.ExecuteCommand(spQuery, ht);

                //Update Primary Key and Custom Code
                GenericFactoryEF_Company.updateMaxID("CmnCompany", Convert.ToInt64(NextId));
                //GFactory_EF_CmnCustomCode.updateCustomCode(customCodeID, DateTime.Now, 0, 1, 1);
            }
            catch (Exception ex)
            {
                ErrorLog.Log(ex);
                ex.ToString();
            }

            return(result);
        }
示例#10
0
        /// Static ID Provided
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int SaveMenu(CmnMenu model)
        {
            GenericFactoryFor_Menu = new vmCmnMenu_GF();
            int result = 0;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("MenuID", model.MenuID);
                ht.Add("CustomCode", model.CustomCode);
                ht.Add("MenuName", model.MenuName);
                ht.Add("ModuleID", model.ModuleID);
                ht.Add("MenuPath", model.MenuPath);
                ht.Add("ReportName", model.ReportName);
                ht.Add("ReportPath", model.ReportPath);
                ht.Add("ParentID", model.ParentID);
                ht.Add("Sequence", model.Sequence);
                ht.Add("MenuTypeID", model.MenuTypeID);
                ht.Add("StatusID", model.StatusID);
                ht.Add("MenuIconCss", model.MenuIconCss);
                ht.Add("CompanyID", model.CompanyID);
                ht.Add("CreateBy", 1);
                ht.Add("CreateOn", DateTime.Now);
                ht.Add("CreatePc", HostService.GetIP());
                ht.Add("UpdateBy", model.UpdateBy);
                ht.Add("UpdateOn", model.UpdateOn);
                ht.Add("UpdatePc", model.UpdatePc);
                ht.Add("IsDeleted", model.IsDeleted);
                ht.Add("DeleteBy", model.DeleteBy);
                ht.Add("DeleteOn", model.DeleteOn);
                ht.Add("DeletePc", model.DeletePc);

                string spQuery = "[Set_CmnMenu]";
                result = GenericFactoryFor_Menu.ExecuteCommand(spQuery, ht);
            }
            catch (Exception e)
            {
                e.ToString();
            }

            return(result);
        }
示例#11
0
        /// <summary>
        /// Update Delete From Database
        /// <para>Use it when delete data through a stored procedure</para>
        /// </summary>
        public int DeleteModule(int?ModuleID)
        {
            GenericFactoryFor_Module = new vmCmnModule_GF();
            int result = 0;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("ModuleID", ModuleID);

                string spQuery = "[Delete_CmnModule]";
                result = GenericFactoryFor_Module.ExecuteCommand(spQuery, ht);
            }
            catch (Exception e)
            {
                e.ToString();
            }

            return(result);
        }
示例#12
0
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int SaveErrorLog(vmErrorStack model)
        {
            int result = 0;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("tblErrorLog", model);
                string spQuery = "[Set_AppErrorLog]";
                result = GenericFactoryFor_Error.ExecuteCommand(spQuery, ht);
            }
            catch (Exception ex)
            {
                result = 0;
                ErrorLog.Log(ex);
                ex.ToString();
            }

            return(result);
        }
示例#13
0
        /// Static ID Provided
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int SaveModule(CmnModule model)
        {
            GenericFactoryFor_Module = new vmCmnModule_GF();
            int result = 0;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("ModuleID", model.ModuleID);
                ht.Add("CustomCode", model.CustomCode);
                ht.Add("ModuleName", model.ModuleName);
                ht.Add("Description", model.Description);
                ht.Add("Sequence", model.Sequence);
                ht.Add("ImageURL", model.ImageURL);
                ht.Add("ModulePath", model.ModulePath);
                ht.Add("StatusID", 1);
                ht.Add("CompanyID", model.CompanyID);
                ht.Add("CreateBy", 1);
                ht.Add("CreateOn", DateTime.Now);
                ht.Add("CreatePc", HostService.GetIP());
                ht.Add("UpdateBy", model.UpdateBy);
                ht.Add("UpdateOn", model.UpdateOn);
                ht.Add("UpdatePc", model.UpdatePc);
                ht.Add("IsDeleted", model.IsDeleted);
                ht.Add("DeleteBy", model.DeleteBy);
                ht.Add("DeleteOn", model.DeleteOn);
                ht.Add("DeletePc", model.DeletePc);


                string spQuery = "[Set_CmnModule]";
                result = GenericFactoryFor_Module.ExecuteCommand(spQuery, ht);
            }
            catch (Exception e)
            {
                e.ToString();
            }

            return(result);
        }
示例#14
0
        /// <summary>
        /// Update Delete From Database
        /// <para>Use it when delete data through a stored procedure</para>
        /// </summary>
        public int DeleteCompany(int?CompanyID, UserCommonEntity commonEntity)
        {
            GenericFactoryFor_Company = new CmnCompany_GF();
            int result = 0;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("CompanyID", CompanyID);
                ht.Add("LoggedCompanyID", commonEntity.loggedCompnyID);
                ht.Add("LoggedUser", commonEntity.loggedUserID);
                string spQuery = "[Delete_CmnCompany]";
                result = GenericFactoryFor_Company.ExecuteCommand(spQuery, ht);
            }
            catch (Exception ex)
            {
                ErrorLog.Log(ex);
                ex.ToString();
            }

            return(result);
        }
示例#15
0
        /// <summary>
        /// Save Data To Database
        /// <para>Use it when save data through a stored procedure</para>
        /// </summary>
        public int SaveCompanyParam(CmnCompany model, UserCommonEntity commonEntity)
        {
            GenericFactoryFor_Company = new CmnCompany_GF();
            GenericFactoryEF_Company  = new CmnCompany_EF();
            GFactory_EF_CmnCustomCode = new SalCmnCustomCode_EF();
            int result = 0;

            try
            {
                #region CustomCode And Primary Key  Process
                int NextId = Convert.ToInt16(GenericFactoryEF_Company.getMaxID("CmnCompany"));
                model.CompanyID = NextId;
                //......... START for custom code........... //
                //string customCode = "";
                CmnCustomCode objCustomCode = GFactory_EF_CmnCustomCode.FindBy(m => m.MenuID == model.MenuID && m.IsDeleted == false).FirstOrDefault();
                //int customCodeID = Convert.ToInt16(objCustomCode.RecordID);
                //if (customCodeID > 0)
                //{
                //  //  customCode = GenericFactory_EF_SalPIMaster.getCustomCode(customCodeID, DateTime.Now, itemMaster.CompanyID, 1, 1);
                //    customCode = GFactory_EF_CmnCustomCode.getCustomCode(customCodeID, DateTime.Now, 0, 1, 1);
                //}
                //else
                //{
                //    customCode = NextId.ToString();
                //}
                //.........END for custom code............ //

                #endregion CustomCode And Primary Key  Process
                #region Basic Save
                Hashtable ht = new Hashtable();
                ht.Add("CompanyID", model.CompanyID);
                ht.Add("CustomCode", model.CustomCode);
                ht.Add("CompanyShortName", model.CompanyShortName);
                ht.Add("CompanyName", model.CompanyName);
                ht.Add("LoggedCompanyID", commonEntity.loggedCompnyID);
                ht.Add("LoggedUser", commonEntity.loggedUserID);

                //  ht.Add("StatusID", model.StatusID);
                string spQuery = "[Set_CmnCompany]";
                result = GenericFactoryFor_Company.ExecuteCommand(spQuery, ht);
                #endregion Basic Save

                #region WorkFlow Transaction Entry
                ////  CHECK WorkFLow Setup
                ////IF targetUserID=0 Then Work flow is not configured
                //int targetUserID = new WorkFLowMgt().GetWorkFlowBeginner(commonEntity);
                //if (targetUserID > 0)
                //{
                //    //IN CASE OF SAVE
                //    //REQUIRD MENUID, COMPANYID, TARGET USERID AS TARGET USERID, USER AS CURRENT USERID,TRANSACTION ID AS MASTERID(INSERTED) ,STATUSID 1
                //    //IS APPROVED 0, IS DELETE 0, IS UPDATE 0 , @APPROVALCUSTOMCODE = '',Is Declained=0
                //    var comment = "";
                //    var APPROVALCUSTOMCODE = string.Empty;
                //    //    int WorkFlowStatus = new WorkFLowMgt().ExecuteWorkFlowTransactionProcess(new WorkFLowMgt().SetProcedureParam(commonEntity, targetUserID, NextId, 0, comment, 0, 0, 1, "", 0));
                //    String MessageName = System.Enum.GetName(typeof(workFlowTranEnum_MessageName), (int)workFlowTranEnum_MessageName.Created);
                //    int WorkFlowStatus = new WorkFLowMgt().ExecuteWorkFlowTransactionProcess(new WorkFLowMgt().SetProcedureParam(commonEntity, targetUserID, NextId, (int)workFlowTranEnum_IsApproved.False, comment, (int)workFlowTranEnum_IsUpdate.False, (int)workFlowTranEnum_IsDelete.False, (int)workFlowTranEnum_Status.Active, APPROVALCUSTOMCODE, (int)workFlowTranEnum_IsDeclained.False, MessageName));

                //}
                #endregion WorkFlow Transaction Entry
                #region CustomCode And Primary Key  Process Update Process
                //Update Primary Key and Custom Code
                GenericFactoryEF_Company.updateMaxID("CmnCompany", Convert.ToInt64(NextId));
                //  GFactory_EF_CmnCustomCode.updateCustomCode(customCodeID, DateTime.Now, 0, 1, 1);
                #endregion  CustomCode And Primary Key  Process Update Process

                #region WorkFlow Transaction Entry Team
                int workflowID = 0;
                List <vmCmnWorkFlowMaster> listWorkFlow = new WorkFLowMgt().GetWorkFlowMasterListByMenu(commonEntity);
                foreach (vmCmnWorkFlowMaster item in listWorkFlow)
                {
                    int userTeamID = item.UserTeamID ?? 0;
                    if (new WorkFLowMgt().checkUserValidation(commonEntity.loggedUserID ?? 0, item.WorkFlowID) && userTeamID > 0)
                    {
                        item.WorkFlowTranCustomID = model.CompanyID;
                        workflowID = new WorkFLowMgt().ExecuteTransactionProcess(item, commonEntity);
                        //Mail Service
                    }
                    if (userTeamID == 0)
                    {
                        item.WorkFlowTranCustomID = model.CompanyID;
                        workflowID = new WorkFLowMgt().ExecuteTransactionProcess(item, commonEntity);
                    }
                }
                #endregion Workflow Transaction Enltry Team
            }
            catch (Exception)
            {
                throw new Exception();
            }

            return(result);
        }