Exemple #1
0
        public List <StaticItem> GetModuleName()
        {
            List <StaticItem> objOfModuleMappingList = new List <StaticItem>();
            string            vComTxt = @"select ModuleCode,ModuleName from LS_Module ";

            try
            {
                SqlConnection connection = _supplierDbContext.GetConn();
                connection.Open();
                SqlDataReader dr;
                SqlCommand    command = new SqlCommand(vComTxt, connection);
                dr = command.ExecuteReader();
                while (dr.Read())
                {
                    StaticItem objModuleObjMapping = new StaticItem();

                    objModuleObjMapping.DataValue = dr["ModuleCode"].ToString();
                    objModuleObjMapping.TextValue = dr["ModuleName"].ToString();

                    objOfModuleMappingList.Add(objModuleObjMapping);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(objOfModuleMappingList);
        }
Exemple #2
0
        public EmailFormat GetEmailFormat(int emailID)
        {
            EmailFormat   objEmailFormat = new EmailFormat();
            string        vComTxt        = @"SELECT  [EmailCode]
                                      ,[EmailID]
                                      ,[EmailSubject]
                                      ,[EmailBody]
                                  FROM  [General_EmailFormat]
                                  WHERE [EmailID]= '" + emailID + "'";
            SqlConnection connection     = _supplierDbContext.GetConn();

            connection.Open();
            SqlDataReader dr;
            SqlCommand    objDbCommand = new SqlCommand(vComTxt, connection);

            dr = objDbCommand.ExecuteReader();
            if (dr.Read())
            {
                objEmailFormat = new EmailFormat();
                objEmailFormat.EmailCode_PK = dr["EmailCode"].ToString();
                objEmailFormat.EmailID      = Convert.ToInt16(dr["EmailID"].ToString());
                objEmailFormat.EmailSubject = dr["EmailSubject"].ToString();
                objEmailFormat.EmailBody    = dr["EmailBody"].ToString();
            }
            dr.Close();
            connection.Close();
            return(objEmailFormat);
        }
        public List <GeneralCodeFile> GetGeneralCodeFileByFileTypeNFileLevel(Int32 FileTypeCode, Int32 LevelCode, Int32 COMPANY_CODE)
        {
            List <GeneralCodeFile> listGeneralCodeFile = new List <GeneralCodeFile>();
            GeneralCodeFile        objGeneralCodeFile;
            string vComTxt = @"SELECT [FileCode]
                            ,[UserCode]
                            ,[ActionType]
                            ,[ActionDate]
                            ,[FileId]
                           ,[FileName] 
                            ,[FileShortName]
                            ,[SortOrder]
                            ,[ParentFileCode]
                            ,[FileTypeCode]
                            ,[LevelCode]
                            ,[CompanyCode]
                            ,[ModuleCode]
                            ,[IsReadOnly]
                            FROM [dbo].[General_CodeFile]
                            where FileTypeCode=@FileTypeCode
                            and LevelCode=@LevelCode
                            AND CompanyCode = " + COMPANY_CODE + "" +
                             " order by [SortOrder]";
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            SqlDataReader dr;
            SqlCommand    objDbCommand = new SqlCommand(vComTxt, connection);

            objDbCommand.Parameters.AddWithValue("FileTypeCode", FileTypeCode);
            objDbCommand.Parameters.AddWithValue("LevelCode", LevelCode);
            dr = objDbCommand.ExecuteReader();
            while (dr.Read())
            {
                objGeneralCodeFile                = new GeneralCodeFile();
                objGeneralCodeFile.FileCode_PK    = Convert.ToInt32(dr["FileCode"].ToString());
                objGeneralCodeFile.UserCode       = dr["UserCode"].ToString();
                objGeneralCodeFile.ActionType     = dr["ActionType"].ToString();
                objGeneralCodeFile.FileId         = dr["FileId"].ToString();
                objGeneralCodeFile.FileName       = dr["FileName"].ToString();
                objGeneralCodeFile.FileShortName  = dr["FileShortName"].ToString();
                objGeneralCodeFile.SortOrder      = dr["SortOrder"].ToString();
                objGeneralCodeFile.ParentFileCode = dr["ParentFileCode"].ToString();
                objGeneralCodeFile.FileTypeCode   = Convert.ToInt32(dr["FileTypeCode"].ToString());
                objGeneralCodeFile.LevelCode      = Convert.ToInt32(dr["LevelCode"].ToString());
                if (!string.IsNullOrEmpty(dr["CompanyCode"].ToString()))
                {
                    objGeneralCodeFile.CompanyCode_FK = Convert.ToInt32(dr["CompanyCode"].ToString());
                }
                objGeneralCodeFile.ModuleCode = dr["ModuleCode"].ToString();
                if (!string.IsNullOrEmpty(dr["IsReadOnly"].ToString()))
                {
                    objGeneralCodeFile.IsReadOnly = Convert.ToBoolean(Convert.ToInt16(dr["IsReadOnly"].ToString()));
                }
                listGeneralCodeFile.Add(objGeneralCodeFile);
            }
            objDbCommand.Dispose();
            return(listGeneralCodeFile);
        }
Exemple #4
0
        public string SaveItemReceive(ItemReceive objItemReceive)
        {
            int       vResult    = 0;
            string    vOut       = "Exception Occured !";
            ArrayList vQueryList = new ArrayList();

            objItemReceive.TableName_TBL = Inv_ItemReceive_TBL;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                if (string.IsNullOrEmpty(objItemReceive.ReceiveCode_PK))
                {
                    objItemReceive.ReceiveCode_PK = Guid.NewGuid().ToString();
                    objItemReceive.GRN            = _iIDGenCriteriaInfo.GenerateID(trans, objItemReceive, EnumIdCategory.GRN);
                }
                vQueryList.Add(GetQuery(objItemReceive));
                foreach (ItemReceiveDet objItemReceiveDet in objItemReceive.ItemReceiveDet_VW)
                {
                    if (string.IsNullOrEmpty(objItemReceiveDet.ReceiveDetCode_PK))
                    {
                        objItemReceiveDet.ReceiveDetCode_PK = Guid.NewGuid().ToString();
                        objItemReceiveDet.TableName_TBL     = Inv_ItemReceiveDet_TBL;
                        objItemReceiveDet.ReceiveCode_FK    = objItemReceive.ReceiveCode_PK;
                    }
                    vQueryList.Add(GetQuery(objItemReceiveDet));
                }

                try
                {
                    using (SqlCommand command = new SqlCommand("", connection, trans))
                    {
                        command.CommandType = System.Data.CommandType.Text;
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        trans.Commit();
                        vOut = objItemReceive.GRN;
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
        public string SaveTermsAndCondition(List <TermsAndCondition> objTermsAndCondition)
        {
            int    vResult = 0;
            string vOut    = "Exception Occured !";

            List <string> vQueryList = new List <string>();
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                foreach (TermsAndCondition termsAndCondition in objTermsAndCondition)
                {
                    termsAndCondition.TableName_TBL = TermsAndCondition_TBL;
                    if (string.IsNullOrEmpty(termsAndCondition.ConditionCode_PK))
                    {
                        termsAndCondition.ConditionCode_PK = Guid.NewGuid().ToString();
                        vQueryList.Add(_cRUD.CREATEQuery(termsAndCondition));
                    }
                    else
                    {
                        vQueryList.Add(_cRUD.UPDATEQuery(termsAndCondition));
                    }
                }

                try
                {
                    using (SqlCommand command = new SqlCommand("", connection, trans))
                    {
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            command.Transaction = trans;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        trans.Commit();
                        vOut = "Terms and Condition Saved Successfully";
                    }
                }

                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
        public string SaveRFPProcessing(RFProcessing objRFProcessing)
        {
            int       vResult         = 0;
            int       vApprovalResult = 0;
            string    vOut            = "Exception Occured !";
            ArrayList vQueryList      = new ArrayList();

            objRFProcessing.TableName_TBL = PMS_RFProcessing_TBL;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                if (string.IsNullOrEmpty(objRFProcessing.RFProcessCode_PK))
                {
                    objRFProcessing.RFProcessCode_PK = Guid.NewGuid().ToString();
                    objRFProcessing.RFProcessId      = _iIDGenCriteriaInfo.GenerateID(trans, objRFProcessing, EnumIdCategory.RFPProcessing);
                }
                vQueryList.Add(GetQuery(objRFProcessing));

                try
                {
                    using (SqlCommand command = _supplierDbContext.GetCommand())
                    {
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        vApprovalResult = AppObjectInfoMapDC.GenerateApprovalFromOtherObject(30, objRFProcessing.RFProcessCode_PK, objRFProcessing.UserCode, objRFProcessing.CompanyCode_FK, connection, trans);
                        if (vApprovalResult > 0)
                        {
                            trans.Commit();
                            vOut = "RFP Saved Successfully";
                        }
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
Exemple #7
0
        public string SaveGeneralCodeFileType(GeneralCodeFileType objGeneralCodeFileType)
        {
            int       vResult    = 0;
            string    vOut       = "Exception Occured !";
            ArrayList vQueryList = new ArrayList();

            objGeneralCodeFileType.TableName_TBL = GeneralCodeFileType_TBL;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();


            using (SqlTransaction trans = connection.BeginTransaction())
            {
                vQueryList.Add(GetQuery(objGeneralCodeFileType));

                try
                {
                    using (SqlCommand command = _supplierDbContext.GetCommand())
                    {
                        //command.Parameters.AddWithValue("FileTypeCode", objGeneralCodeFileType.FileTypeCode_PK);
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            command.Transaction = trans;
                            vResult             = command.ExecuteNonQuery();
                        }
                        if (vResult > 0)
                        {
                            trans.Commit();
                            vOut = "Code File Type Saved Successfully";
                        }
                        else
                        {
                            vOut = "File Type Code is duplicate";
                        }
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
        public List <IDGenCriteriaInfo> GetObjectByID(SqlTransaction objTransaction, IDGenCriteriaInfo objIDGenCriteriaInfo)
        {
            string pCompanyCode = String.Empty;

            pCompanyCode = objIDGenCriteriaInfo.CompanyCode_FK.ToString();
            List <IDGenCriteriaInfo> objIDGenCriteriaInfoList = new List <IDGenCriteriaInfo>();
            IDGenCriteriaInfo        IDGenCriteriaInfo        = new IDGenCriteriaInfo();
            StringBuilder            vComText = new StringBuilder();

            vComText.Append("SELECT CriteriaCode,CAST(CriteriaID as NUMERIC) CriteriaID,CriteriaName,CompanyCode,UserCode,ActionDate,ActionType,CriteriaConditionText FROM LS_IDGenCriteria Where CompanyCode =" + pCompanyCode + "");
            if (!string.IsNullOrEmpty(objIDGenCriteriaInfo.CriteriaCode_PK))
            {
                vComText.Append(" AND CriteriaCode='" + objIDGenCriteriaInfo.CriteriaCode_PK + "'");
            }
            else if (!string.IsNullOrEmpty(objIDGenCriteriaInfo.CriteriaID))
            {
                vComText.Append(" AND CriteriaID='" + objIDGenCriteriaInfo.CriteriaID + "'");
            }
            vComText.Append(" Order By CriteriaId");
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            SqlDataReader dr;
            SqlCommand    objDbCommand = new SqlCommand(vComText.ToString(), connection);

            dr = objDbCommand.ExecuteReader();
            while (dr.Read())
            {
                IDGenCriteriaInfo                       = new IDGenCriteriaInfo();
                IDGenCriteriaInfo.IsNew                 = false;
                IDGenCriteriaInfo.CompanyCode_FK        = Convert.ToInt16(dr["CompanyCode"]);
                IDGenCriteriaInfo.UserCode              = dr["UserCode"].ToString();
                IDGenCriteriaInfo.ActionDate            = dr["ActionDate"].ToString();
                IDGenCriteriaInfo.ActionType            = dr["ActionType"].ToString();
                IDGenCriteriaInfo.CriteriaCode_PK       = dr["CriteriaCode"].ToString();
                IDGenCriteriaInfo.CriteriaID            = dr["CriteriaID"].ToString();
                IDGenCriteriaInfo.CriteriaName          = dr["CriteriaName"].ToString();
                IDGenCriteriaInfo.CriteriaConditionText = dr["CriteriaConditionText"].ToString();
                objIDGenCriteriaInfoList.Add(IDGenCriteriaInfo);
            }
            dr.Close();
            if (objIDGenCriteriaInfoList.Count == 1)
            {
                IDGenCriteriaInfo.IDGenCriteriaConditionList_VW = GetCriteriaConditionList(objTransaction, IDGenCriteriaInfo);
            }
            return(objIDGenCriteriaInfoList);
        }
Exemple #9
0
        public string SavePurchaseOrder(PurchaseOrder objPurchaseOrder)
        {
            int       vResult    = 0;
            string    vOut       = "Exception Occured !";
            ArrayList vQueryList = new ArrayList();

            objPurchaseOrder.TableName_TBL = PurchaseOrder_TBL;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                if (string.IsNullOrEmpty(objPurchaseOrder.PurchaseOrderCode_PK))
                {
                    objPurchaseOrder.PurchaseOrderCode_PK = Guid.NewGuid().ToString();
                    objPurchaseOrder.PurchaseOrderNo      = _iIDGenCriteriaInfo.GenerateID(trans, objPurchaseOrder, EnumIdCategory.PurchaseOrderNo);
                }
                vQueryList.Add(GetQuery(objPurchaseOrder));

                try
                {
                    using (SqlCommand command = _supplierDbContext.GetCommand())
                    {
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        trans.Commit();
                        vOut = "Purchase Order Saved Successfully";
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
        public List <GeneralCodeFileLevel> GetGeneralCodeFileLevelByFileType(Int32 fileTypeCode_PK, Int32 companyCode_PK)
        {
            List <GeneralCodeFileLevel> listGeneralCodeFileLevel = new List <GeneralCodeFileLevel>();
            GeneralCodeFileLevel        objGeneralCodeFileLevel;
            string vComTxt = @"SELECT [LevelCode]
                            ,[UserCode]
                            ,[ActionType]
                            ,[ActionDate]
                            ,[LevelId]
                            ,[LevelName]
                            ,[FileTypeCode]
                            ,[CompanyCode]
                            ,[FileIdStartFrom]
                            ,[ModuleCode]
                            FROM [dbo].[General_CodeFileLevel]
                            where FileTypeCode=" + fileTypeCode_PK + " And CompanyCode = " + companyCode_PK + "";


            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            SqlDataReader dr;
            SqlCommand    objDbCommand = new SqlCommand(vComTxt, connection);

            dr = objDbCommand.ExecuteReader();

            while (dr.Read())
            {
                objGeneralCodeFileLevel = new GeneralCodeFileLevel();
                objGeneralCodeFileLevel.LevelCode_PK = Convert.ToInt32(dr["LevelCode"].ToString());
                objGeneralCodeFileLevel.UserCode     = dr["UserCode"].ToString();
                objGeneralCodeFileLevel.ActionType   = dr["ActionType"].ToString();
                objGeneralCodeFileLevel.LevelId      = dr["LevelId"].ToString();
                objGeneralCodeFileLevel.LevelName    = dr["LevelName"].ToString();
                objGeneralCodeFileLevel.FileTypeCode = Convert.ToInt32(dr["FileTypeCode"].ToString());
                if (!string.IsNullOrEmpty(dr["CompanyCode"].ToString()))
                {
                    objGeneralCodeFileLevel.CompanyCode_FK = Convert.ToUInt16(dr["CompanyCode"].ToString());
                }
                objGeneralCodeFileLevel.FileIdStartFrom = dr["FileIdStartFrom"].ToString();
                objGeneralCodeFileLevel.ModuleCode      = dr["ModuleCode"].ToString();
                listGeneralCodeFileLevel.Add(objGeneralCodeFileLevel);
            }

            return(listGeneralCodeFileLevel);
        }
Exemple #11
0
        public string SaveProduct(Product objproduct)
        {
            int    vResult = 0;
            string vOut    = "Exception Occured !";

            objproduct.TableName_TBL = Product_TBL;
            string        vQuery     = string.Empty;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                if (string.IsNullOrEmpty(objproduct.ProductCode_PK))
                {
                    objproduct.ProductCode_PK = Guid.NewGuid().ToString();
                    objproduct.ProductID      = _iIDGenCriteriaInfo.GenerateID(trans, objproduct, EnumIdCategory.ProductID);
                }
                vQuery = _cRUD.CREATEQuery(objproduct);
                try
                {
                    using (SqlCommand command = _supplierDbContext.GetCommand())
                    {
                        command.CommandText = vQuery;
                        vResult             = command.ExecuteNonQuery();
                    }
                    if (vResult > 0)
                    {
                        trans.Commit();
                        vOut = "Product Saved Successfully";
                    }
                }

                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
        public List <Employee> GetEmployeeAll()
        {
            List <Employee> objEmployeeList = new List <Employee>();
            Employee        objEmployee;
            string          vComTxt    = @"SELECT EmployeeCode
                                ,EmployeeId
                                ,Name
                                ,DepartmentCode
                                ,dbo.fxn_FileName(DepartmentCode) AS Department
                                ,DesignationCode
                                ,dbo.fxn_FileName(DesignationCode) AS Designation
                                ,JobStatus
                                ,EligibleForOT
                                FROM  HR_Employee WHERE CompanyCode =1 AND ActionType != 'Delete' ORDER BY EmployeeId ASC";
            SqlConnection   connection = _supplierDbContext.GetConn();

            connection.Open();
            SqlDataReader dr;
            SqlCommand    objDbCommand = new SqlCommand(vComTxt, connection);

            dr = objDbCommand.ExecuteReader();
            while (dr.Read())
            {
                objEmployee = new Employee();
                objEmployee.EmployeeCode_PK    = dr["EmployeeCode"].ToString();
                objEmployee.EmployeeId         = dr["EmployeeId"].ToString();
                objEmployee.Name               = dr["Name"].ToString();
                objEmployee.DepartmentCode_FK  = Convert.ToInt16(dr["DepartmentCode"].ToString());
                objEmployee.Department_VW      = dr["Department"].ToString();
                objEmployee.DesignationCode_FK = Convert.ToInt16(dr["DesignationCode"].ToString());
                objEmployee.Designation_VW     = dr["Designation"].ToString();

                objEmployeeList.Add(objEmployee);
            }
            return(objEmployeeList);
        }
        public List <GeneralWaitingForApproval> GetDashBoardData(string pUserId)
        {
            List <GeneralWaitingForApproval> objIGeneralWaitingForApprovalList = new List <GeneralWaitingForApproval>();
            string        vComTxt    = @"SELECT count(A.ModuleObjMapCode) NoOfOjectToApprove
                                ,A.ModuleObjMapCode
                                ,B.DashBoardCaption--,dbo.fxn_WorkingUnitByCode(A.CompanyCode) AS Company    
                                FROM General_WaitingForApproval A 
                                inner join LS_AppObjectInfoMap B on A.ModuleObjMapCode=B.ModuleObjMapCode And A.CompanyCode = B.CompanyCode  
                                where B.Active=1 AND AppUserCode='" + pUserId + @"'
                                and ResponseStatus=0                                
                                and A.ActionType <> 'Delete' 
                                group by A.ModuleObjMapCode,B.DashBoardCaption,A.CompanyCode ";
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            SqlDataReader dr;
            SqlCommand    objDbCommand = new SqlCommand(vComTxt, connection);

            dr = objDbCommand.ExecuteReader();
            try
            {
                while (dr.Read())
                {
                    GeneralWaitingForApproval objIGeneralWaitingForApproval = new GeneralWaitingForApproval();
                    objIGeneralWaitingForApproval.ModuleObjMapCode       = dr["ModuleObjMapCode"].ToString();
                    objIGeneralWaitingForApproval.NoOfObjectToApprove_VW = Convert.ToInt32(dr["NoOfOjectToApprove"]);
                    objIGeneralWaitingForApproval.DashBoardCaption_VW    = dr["DashBoardCaption"].ToString();
                    //objIGeneralWaitingForApproval.CompanyName_VW = dr["Company"].ToString();
                    objIGeneralWaitingForApprovalList.Add(objIGeneralWaitingForApproval);
                }
            }
            catch (DbException ex)
            {
                throw ex;
            }
            finally
            {
            }

            return(objIGeneralWaitingForApprovalList);
        }
        public List<StaticDropDownListItem> GetStaticDropDownListByCode(int? DropdownCode)
        {
            List<StaticDropDownListItem> ddListItem = new List<StaticDropDownListItem>();
            StaticDropDownListItem item = new StaticDropDownListItem();
            string vComTxt = string.Empty;
            try
            {
                if (DropdownCode != null)
                {
                    vComTxt = @"SELECT  *FROM LS_StaticDropDownListItem Where DropdownCode = '" + DropdownCode + "'";
                }
                else
                {
                    vComTxt = @"SELECT  *FROM LS_StaticDropDownListItem";
                }
                SqlConnection connection = _supplierDbContext.GetConn();
                connection.Open();
                SqlDataReader dr;
                SqlCommand command = new SqlCommand(vComTxt, connection);
                dr = command.ExecuteReader();
                while (dr.Read())
                {
                    item = new StaticDropDownListItem();
                    item.DropDownCode_PK = Convert.ToInt32(dr["DropdownCode"]);
                    item.ItemCode = Convert.ToInt32(dr["ItemCode"]);
                    item.ItemValue = Convert.ToInt32(dr["ItemValue"]);
                    item.ItemText = dr["ItemText"].ToString();

                    ddListItem.Add(item);
                }

                return ddListItem;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public AppObjInfoMap_Logic GetIAppObjInfoMap_Logic(AppObjInfoMap_Logic objIAppObjInfoMap_Logic)
        {
            string vComTxt = @"SELECT Distinct  A.[ObjAppInfoMapLogicCode]
                                  ,A.[ModuleObjMapCode]
                                  ,A.[IsFieldPolicy]
                                  ,A.[FieldType1]
                                  ,A.[DBFieldName1]
                                  ,A.[FieldType2]
                                  ,A.[DBFieldName2]
                                  ,A.[FieldType3]
                                  ,A.[DBFieldName3]
                              FROM [LS_AppObjInfoMap_Logic] A
                                        JOIN LS_AppObjectInfoMap B ON A.ModuleObjMapCode = B.ModuleObjMapCode
                                    AND A.CompanyCode = 1 WHERE A.ActionType<>'DELETE'  AND B.Active=1";


            if (!String.IsNullOrEmpty(objIAppObjInfoMap_Logic.ModuleObjMapCode_FK))
            {
                vComTxt += @" And  A.ModuleObjMapCode ='" + objIAppObjInfoMap_Logic.ModuleObjMapCode_FK + "'";
            }
            SqlConnection connection = _supplierDbContext.GetConn();

            try
            {
                connection.Open();
                SqlDataReader dr;
                SqlCommand    command = new SqlCommand(vComTxt, connection);
                dr = command.ExecuteReader();
                //while (dr.Read())
                //{
                if (dr.Read())
                {
                    objIAppObjInfoMap_Logic.ObjAppInfoMapLogicCode_PK = dr["ObjAppInfoMapLogicCode"].ToString();
                    objIAppObjInfoMap_Logic.ModuleObjMapCode_FK       = dr["ModuleObjMapCode"].ToString();

                    objIAppObjInfoMap_Logic.IsFieldPolicy = Convert.ToInt32(dr["IsFieldPolicy"]);

                    if (objIAppObjInfoMap_Logic.IsFieldPolicy == 1)
                    {
                        if (!string.IsNullOrEmpty(dr["FieldType1"].ToString()))
                        {
                            objIAppObjInfoMap_Logic.FieldType1 = Convert.ToInt32(dr["FieldType1"]);
                        }

                        if (!string.IsNullOrEmpty(dr["DBFieldName1"].ToString()))
                        {
                            objIAppObjInfoMap_Logic.DBFieldName1 = dr["DBFieldName1"].ToString();
                        }
                        if (!string.IsNullOrEmpty(dr["FieldType2"].ToString()))
                        {
                            objIAppObjInfoMap_Logic.FieldType2 = Convert.ToInt32(dr["FieldType2"]);
                        }
                        if (!string.IsNullOrEmpty(dr["DBFieldName2"].ToString()) && dr["DBFieldName2"].ToString() != "-1")
                        {
                            objIAppObjInfoMap_Logic.DBFieldName2 = dr["DBFieldName2"].ToString();
                        }

                        if (!string.IsNullOrEmpty(dr["FieldType3"].ToString()))
                        {
                            objIAppObjInfoMap_Logic.FieldType3 = Convert.ToInt32(dr["FieldType3"]);
                        }

                        if (!string.IsNullOrEmpty(dr["DBFieldName3"].ToString()) && dr["DBFieldName3"].ToString() != "-1")
                        {
                            objIAppObjInfoMap_Logic.DBFieldName3 = dr["DBFieldName3"].ToString();
                        }

                        //if (!string.IsNullOrEmpty(dr["ActiveYN"].ToString()))
                        //{
                        //    objIAppObjInfoMap_Logic.ActiveYN = Convert.ToInt32(dr["ActiveYN"]);
                        //}
                        GetAppObjInfoMapLogicValuesList(objIAppObjInfoMap_Logic);
                    }
                }
                else
                {
                    objIAppObjInfoMap_Logic = null;
                }
                //}
            }

            catch (DbException ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }


            return(objIAppObjInfoMap_Logic);
        }
        public string SavePurchaseRequsition(PurchaseRequisition objPMS_PurchaseRequisition)
        {
            int       vResult         = 0;
            int       vApprovalResult = 0;
            string    vOut            = "Exception Occured !";
            ArrayList vQueryList      = new ArrayList();

            objPMS_PurchaseRequisition.TableName_TBL = PMS_PurchaseRequisition_TBL;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                if (string.IsNullOrEmpty(objPMS_PurchaseRequisition.RequisitionCode_PK))
                {
                    objPMS_PurchaseRequisition.RequisitionCode_PK = Guid.NewGuid().ToString();
                    objPMS_PurchaseRequisition.RequisitionID      = _iIDGenCriteriaInfo.GenerateID(trans, objPMS_PurchaseRequisition, EnumIdCategory.PurchaseRequsition);
                }
                vQueryList.Add(GetQuery(objPMS_PurchaseRequisition));
                foreach (PurchaseRequisitionItem objPurchaseRequisitionItem in objPMS_PurchaseRequisition.PurchaseRequisitionItemList_VW)
                {
                    if (string.IsNullOrEmpty(objPurchaseRequisitionItem.RequisitionDetCode_PK))
                    {
                        objPurchaseRequisitionItem.RequisitionDetCode_PK = Guid.NewGuid().ToString();
                        objPurchaseRequisitionItem.TableName_TBL         = PMS_PurchaseRequisitionItem_TBL;
                        objPurchaseRequisitionItem.RequisitionCode       = objPMS_PurchaseRequisition.RequisitionCode_PK;
                    }
                    vQueryList.Add(GetQuery(objPurchaseRequisitionItem));
                    foreach (PurchaseReqItemSpecification objPurchaseReqItemSpecification in objPurchaseRequisitionItem.PurchaseReqItemSpecificationList_VW)
                    {
                        if (string.IsNullOrEmpty(objPurchaseReqItemSpecification.SpecificationCode_PK))
                        {
                            objPurchaseReqItemSpecification.SpecificationCode_PK = Guid.NewGuid().ToString();
                            objPurchaseReqItemSpecification.TableName_TBL        = PMS_PurchaseReqItemSpecification_TBL;
                            objPurchaseReqItemSpecification.RequisitionDetCode   = objPurchaseRequisitionItem.RequisitionDetCode_PK;
                        }
                        vQueryList.Add(GetQuery(objPurchaseReqItemSpecification));
                    }
                }
                foreach (PurchaseRequisitionCondition objPurchaseRequisitionTerms in objPMS_PurchaseRequisition.PurchaseRequisitionTermsList_VW)
                {
                    if (!string.IsNullOrEmpty(objPurchaseRequisitionTerms.ConditionCode_PK))
                    {
                        //objPurchaseRequisitionTerms.ConditionCode_PK = Guid.NewGuid().ToString();
                        objPurchaseRequisitionTerms.TableName_TBL   = PMS_RequisitionTermsCondition_TBL;
                        objPurchaseRequisitionTerms.RequisitionCode = objPMS_PurchaseRequisition.RequisitionCode_PK;
                    }
                    vQueryList.Add(GetQuery(objPurchaseRequisitionTerms));
                }
                try
                {
                    using (SqlCommand command = _supplierDbContext.GetCommand())
                    {
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        vApprovalResult = AppObjectInfoMapDC.GenerateApprovalFromOtherObject(29, objPMS_PurchaseRequisition.RequisitionCode_PK, objPMS_PurchaseRequisition.UserCode, objPMS_PurchaseRequisition.CompanyCode_FK, connection, trans);
                        if (vApprovalResult > 0)
                        {
                            trans.Commit();
                            vOut = "Purchase Requsition Saved Successfully";
                        }
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
        public List <AppLevelDefDetAppType> GetApproverSelection(string appLvDefinitionDetCode_FK)
        {
            //string vComTxt = string.Empty;
            // string vOut = "Exception Occured !";



            List <AppLevelDefDetAppType> objIAppLevelDefDetAppType_List = new List <AppLevelDefDetAppType>();

            string vComTxt = @"SELECT [AppLvDefDetAppTypeCode]
                                      ,[AppLvDefinitionDetCode]
                                      ,[ApproverLevelNo]
                                      ,[ApproverType]
                                      ,[CompanyCode]
                                      ,[UserCode]
                                      ,[ActionDate]
                                      ,[ActionType]
                           FROM  LS_AppLevelDefDetAppType  
                            where AppLvDefinitionDetCode='" + appLvDefinitionDetCode_FK + @"'
                           and  ActionType <> 'Delete' 
                           AND  CompanyCode=1"
                             + @" order by ApproverLevelNo";
            SqlConnection connection = _supplierDbContext.GetConn();

            try
            {
                connection.Open();
                SqlDataReader dr;
                SqlCommand    command = new SqlCommand(vComTxt, connection);
                dr = command.ExecuteReader();
                while (dr.Read())
                {
                    AppLevelDefDetAppType objIAppLevelDefDetAppType_temp = new AppLevelDefDetAppType();

                    if (dr["AppLvDefDetAppTypeCode"] != DBNull.Value)
                    {
                        objIAppLevelDefDetAppType_temp.AppLvDefDetAppTypeCode_PK = dr["AppLvDefDetAppTypeCode"].ToString();
                    }

                    if (dr["AppLvDefinitionDetCode"] != DBNull.Value)
                    {
                        objIAppLevelDefDetAppType_temp.AppLvDefinitionDetCode_FK = dr["AppLvDefinitionDetCode"].ToString();
                    }

                    if (dr["ApproverLevelNo"] != DBNull.Value)
                    {
                        objIAppLevelDefDetAppType_temp.ApproverLevelNo = Convert.ToInt32(dr["ApproverLevelNo"]);
                    }

                    if (dr["ApproverType"] != DBNull.Value)
                    {
                        objIAppLevelDefDetAppType_temp.ApproverType = Convert.ToInt32(dr["ApproverType"]);
                    }

                    objIAppLevelDefDetAppType_temp.IsNew = false;

                    if (objIAppLevelDefDetAppType_temp != null)
                    {
                        objIAppLevelDefDetAppType_temp.objAppLevelDetAppTypeApproverList_VW = GetAppLevelDetAppTypeApproverList(objIAppLevelDefDetAppType_temp.AppLvDefDetAppTypeCode_PK);
                    }

                    objIAppLevelDefDetAppType_List.Add(objIAppLevelDefDetAppType_temp);
                }
            }
            catch (DbException ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }

            return(objIAppLevelDefDetAppType_List);
        }
Exemple #18
0
        public string SaveQuotation(Quotation objQuotation)
        {
            int       vResult    = 0;
            string    vOut       = "Exception Occured !";
            ArrayList vQueryList = new ArrayList();

            objQuotation.TableName_TBL = LSP_PMS_Quotation_TBL;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                if (string.IsNullOrEmpty(objQuotation.QuotationCode_PK))
                {
                    objQuotation.QuotationCode_PK = Guid.NewGuid().ToString();
                    objQuotation.QuotationNo      = _iIDGenCriteriaInfo.GenerateID(trans, objQuotation, EnumIdCategory.QuotationNo);
                }
                vQueryList.Add(GetQuery(objQuotation));
                foreach (QuotationItem objQuotationItem in objQuotation.QuotationItemList_VW)
                {
                    if (string.IsNullOrEmpty(objQuotationItem.QuotationDetCode_PK))
                    {
                        objQuotationItem.QuotationDetCode_PK = Guid.NewGuid().ToString();
                        objQuotationItem.TableName_TBL       = LSP_PMS_QuotationItem_TBL;
                        objQuotationItem.QuotationCode       = objQuotation.QuotationCode_PK;
                    }
                    vQueryList.Add(GetQuery(objQuotationItem));
                    foreach (QuotationItemSpecification objQuotationItemSpecification in objQuotationItem.QuotationItemSpecificationList_VW)
                    {
                        if (string.IsNullOrEmpty(objQuotationItemSpecification.QuotationItemSpecificationCode_PK))
                        {
                            objQuotationItemSpecification.QuotationItemSpecificationCode_PK = Guid.NewGuid().ToString();
                            objQuotationItemSpecification.TableName_TBL       = LSP_PMS_QuotationItemSpecification_TBL;
                            objQuotationItemSpecification.QuotationDetCode_FK = objQuotationItem.QuotationDetCode_PK;
                        }
                        vQueryList.Add(GetQuery(objQuotationItemSpecification));
                    }
                }
                foreach (QuotationCondition objQuotationCondition in objQuotation.QuotationConditionList_VW)
                {
                    if (!string.IsNullOrEmpty(objQuotationCondition.ConditionCode_PK))
                    {
                        objQuotationCondition.TableName_TBL = LSP_PMS_QuotationCondition_TBL;
                        objQuotationCondition.QuotationCode = objQuotation.QuotationCode_PK;
                    }
                    vQueryList.Add(GetQuery(objQuotationCondition));
                }
                try
                {
                    using (SqlCommand command = new SqlCommand("", connection, trans))
                    {
                        command.CommandType = System.Data.CommandType.Text;
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        trans.Commit();
                        vOut = "Quotation Saved Successfully";
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
Exemple #19
0
        public string SaveSupplierInvoice(SupplierInvoice objSupplierInvoice)
        {
            int       vResult      = 0;
            string    vOut         = "Exception Occured !";
            string    vUpdateQuery = String.Empty;
            ArrayList vQueryList   = new ArrayList();

            objSupplierInvoice.TableName_TBL = PMS_SupplierInvoice_TBL;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                if (string.IsNullOrEmpty(objSupplierInvoice.InvoiceCode_PK))
                {
                    objSupplierInvoice.InvoiceCode_PK = Guid.NewGuid().ToString();
                    objSupplierInvoice.InvoiceNo      = _iIDGenCriteriaInfo.GenerateID(trans, objSupplierInvoice, EnumIdCategory.Invoice);
                }
                vQueryList.Add(GetQuery(objSupplierInvoice));
                foreach (SupplierInvoiceLine objSupplierInvoiceLine in objSupplierInvoice.SupplierInvoiceLine_VW)
                {
                    if (string.IsNullOrEmpty(objSupplierInvoiceLine.InvoiceLineCode_PK))
                    {
                        objSupplierInvoiceLine.InvoiceLineCode_PK = Guid.NewGuid().ToString();
                        objSupplierInvoiceLine.TableName_TBL      = PMS_SupplierInvoiceLine_TBL;
                        objSupplierInvoiceLine.InvoiceCode        = objSupplierInvoice.InvoiceCode_PK;

                        vUpdateQuery = "UPDATE Inv_ItemReceive SET IsInvoiced = 1 " +
                                       "WHERE ReceiveCode = '" + objSupplierInvoiceLine.ReceiveCode + "' and [ActionType] <> 'Delete'";
                    }
                    vQueryList.Add(vUpdateQuery);
                    vQueryList.Add(GetQuery(objSupplierInvoiceLine));
                }

                try
                {
                    using (SqlCommand command = new SqlCommand("", connection, trans))
                    {
                        command.CommandType = System.Data.CommandType.Text;
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                        //command.CommandText = vUpdateQuery;
                        //vResult1 = command.ExecuteNonQuery();
                    }
                    if (vResult > 0)
                    {
                        trans.Commit();
                        vOut = objSupplierInvoice.InvoiceNo;
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
        public string SaveSupplier(SupplierInfo objsupplierInfo)
        {
            int       vResult         = 0;
            int       vApprovalResult = 0;
            string    vOut            = "Exception Occured !";
            ArrayList vQueryList      = new ArrayList();

            objsupplierInfo.TableName_TBL = SupplierInfo_TBL;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                if (string.IsNullOrEmpty(objsupplierInfo.SupplierCode_PK))
                {
                    objsupplierInfo.SupplierCode_PK = Guid.NewGuid().ToString();
                    objsupplierInfo.SupplierID      = _iIDGenCriteriaInfo.GenerateID(trans, objsupplierInfo, EnumIdCategory.SupplierID);
                }
                vQueryList.Add(GetQuery(objsupplierInfo));
                foreach (SupplierContact supplierContact in objsupplierInfo.SupplierContactList_VW)
                {
                    if (string.IsNullOrEmpty(supplierContact.ContactPersonCode_PK))
                    {
                        supplierContact.ContactPersonCode_PK = Guid.NewGuid().ToString();
                        supplierContact.TableName_TBL        = SupplierContact_TBL;
                        supplierContact.SupplierCode_FK      = objsupplierInfo.SupplierCode_PK;
                    }
                    vQueryList.Add(GetQuery(supplierContact));
                }
                foreach (SupplierAttachment supplierAttachment in objsupplierInfo.SupplierAttachmentList_VW)
                {
                    if (string.IsNullOrEmpty(supplierAttachment.AttachmentCode_PK))
                    {
                        supplierAttachment.AttachmentCode_PK = Guid.NewGuid().ToString();
                        supplierAttachment.TableName_TBL     = SupplierAttachment_TBL;
                        supplierAttachment.SupplierCode_FK   = objsupplierInfo.SupplierCode_PK;
                    }
                    vQueryList.Add(GetQuery(supplierAttachment));
                }
                foreach (SupplierBusiness supplierBusiness in objsupplierInfo.SupplierBusinessList_VW)
                {
                    if (supplierBusiness.BusinessTypeCode_PK != 0)
                    {
                        supplierBusiness.TableName_TBL   = SupplierBusiness_TBL;
                        supplierBusiness.SupplierCode_FK = objsupplierInfo.SupplierCode_PK;
                    }
                    vQueryList.Add(GetQuery(supplierBusiness));
                }

                try
                {
                    using (SqlCommand command = new SqlCommand("", connection, trans))
                    {
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        vApprovalResult = AppObjectInfoMapDC.GenerateApprovalFromOtherObject(27, objsupplierInfo.SupplierCode_PK, objsupplierInfo.UserCode, objsupplierInfo.CompanyCode_FK, connection, trans);
                        if (vApprovalResult > 0)
                        {
                            trans.Commit();
                            vOut = "Supplier Information Saved Successfully";
                        }
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
        public string SaveUploadedFiles(List <UploadedFile> objUploadedFileList)
        {
            int           vResult         = 0;
            int           vApprovalResult = 0;
            string        vOut            = "Exception Occured !";
            ArrayList     vQueryList      = new ArrayList();
            SqlConnection connection      = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                foreach (UploadedFile objUploadedFile in objUploadedFileList)
                {
                    if (string.IsNullOrEmpty(objUploadedFile.UploadedCode_PK))
                    {
                        objUploadedFile.TableName_TBL   = UploadedFilesInfo_TBL;
                        objUploadedFile.UploadedCode_PK = Guid.NewGuid().ToString();
                    }
                    vQueryList.Add(GetQuery(objUploadedFile));
                }


                try
                {
                    using (SqlCommand command = new SqlCommand("", connection, trans))
                    {
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        foreach (UploadedFile objUploadedFile in objUploadedFileList)
                        {
                            vApprovalResult = AppObjectInfoMapDC.GenerateApprovalFromOtherObject(28, objUploadedFile.UploadedCode_PK, objUploadedFile.UserCode, objUploadedFile.CompanyCode_FK, connection, trans);
                            if (vApprovalResult == 0)
                            {
                                break;
                            }
                        }
                        if (vApprovalResult > 0)
                        {
                            trans.Commit();
                            vOut = "Supplier Document Uploaded Successfully";
                        }
                        else
                        {
                            trans.Rollback();
                        }
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }