public bool InsertMappedRegions(DataTable dtRegCodes, string UserName)
        {
            bool result = false;

            try
            {
                SqlCommand command = new SqlCommand("SP_HD_InsertMappedRegion");
                command.CommandType = CommandType.StoredProcedure;
                //using (IDbConnection connection = IDbOpenConnection())
                //{
                //    var p = new DynamicParameters();
                //    p.Add("@UserName", UserName);
                //    result=connection.Execute(SP_HD_InsertMappedRegion, p, commandType: CommandType.StoredProcedure);
                //    connection.Close();
                //}

                if (dtRegCodes.Rows.Count == 0)
                {
                    _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_DCRStatus_RegionCodes", ParameterDirection.Input, SqlDbType.Structured, null, "TVP_DCRStatus_RegionCodes");
                }
                else
                {
                    _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_DCRStatus_RegionCodes", ParameterDirection.Input, SqlDbType.Structured, dtRegCodes, "TVP_DCRStatus_RegionCodes");
                }
                _objData.OpenConnection();
                _objData.ExecuteNonQuery(command);
                result = true;
            }
            catch (Exception ex)
            {
                throw;
            }
            return(result);
        }
예제 #2
0
        public bool InsertMasterData(DataTable dtUserCodes)
        {
            bool result = false;

            try
            {
                SqlCommand command = new SqlCommand("SP_HD_InsertMasterData");
                command.CommandType = CommandType.StoredProcedure;
                if (dtUserCodes.Rows.Count == 0)
                {
                    _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_MasterData_Details", ParameterDirection.Input, SqlDbType.Structured, null, "TVP_MasterData_Details");
                }
                else
                {
                    _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_MasterData_Details", ParameterDirection.Input, SqlDbType.Structured, dtUserCodes, "TVP_MasterData_Details");
                }
                _objData.OpenConnection();
                _objData.ExecuteNonQuery(command);
                result = true;
            }
            catch (Exception ex)
            {
                throw;
            }
            return(result);
        }
예제 #3
0
        public bool InsertUserSession()
        {
            DataControl.Data objData = new DataControl.Data();
            try
            {
                string macId       = GetMACInformation();
                string ipAddress   = Request.ServerVariables["REMOTE_ADDR"].ToString();
                string browserName = Request.Browser.Browser + " " + Request.Browser.MajorVersion.ToString() + "." + Request.Browser.MinorVersion.ToString();
                string companyCode = _objCurInfo.GetCompanyCode();
                string userCode    = _objCurInfo.GetUserCode();
                string userName    = _objCurInfo.GetUserName();
                string sessionId   = _objCurInfo.GetSessionId();
                string latitude    = _objCurInfo.GetLattitude();
                string longitude   = _objCurInfo.GetLongitude();
                string location    = _objCurInfo.GetLocation();
                string loginTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff");

                bool isTrue = false;


                objData.OpenConnection(_objCurInfo.GetCompanyCode());
                {
                    objData.ExecuteNonQuery("exec sp_sdInsertUserSession '" + _objCurInfo.GetCompanyCode() + "','" + _objCurInfo.GetUserCode() + "','" + _objCurInfo.GetUserName() + "','" + _objCurInfo.GetSessionId() + "','" + loginTime + "','" + ipAddress + "','" + macId + "','" + browserName + "','" + latitude + "','" + longitude + "','" + location + "'");
                }

                return(isTrue);
            }
            finally
            {
                objData.CloseConnection();
            }
        }
예제 #4
0
        public int InsertSplashScreenData(string companyCode, SplashScreenModel objSplashScreenModel)
        {
            int result = 0;

            try
            {
                SqlCommand command = new SqlCommand(SP_SC_INSERT_SPLASH_SCREEN_DATA);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@Company_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@Splash_Type", ParameterDirection.Input, SqlDbType.VarChar, 150, objSplashScreenModel.Splash_Type);
                _objSPData.AddParamToSqlCommand(command, "@Title", ParameterDirection.Input, SqlDbType.VarChar, 150, objSplashScreenModel.Title);
                _objSPData.AddParamToSqlCommand(command, "@Description", ParameterDirection.Input, SqlDbType.VarChar, 1000, objSplashScreenModel.Description);
                _objSPData.AddParamToSqlCommand(command, "@File_Path", ParameterDirection.Input, SqlDbType.VarChar, 250, objSplashScreenModel.File_Path);
                _objSPData.AddParamToSqlCommand(command, "@Date_From", ParameterDirection.Input, SqlDbType.Date, 30, objSplashScreenModel.Date_From);
                _objSPData.AddParamToSqlCommand(command, "@Date_To", ParameterDirection.Input, SqlDbType.Date, 30, objSplashScreenModel.Date_To);
                _objSPData.AddParamToSqlCommand(command, "@Has_Attachment", ParameterDirection.Input, SqlDbType.Int, 4, objSplashScreenModel.Has_Attachment);
                _objSPData.AddParamToSqlCommand(command, "@Mobile_Attachment_Url", ParameterDirection.Input, SqlDbType.VarChar, 250, objSplashScreenModel.Mobile_Attachment_Url);
                _objSPData.AddParamToSqlCommand(command, "@Assigned_To_All_Users", ParameterDirection.Input, SqlDbType.Int, 4, objSplashScreenModel.Assigned_To_All_Users);
                _objSPData.AddParamToSqlCommand(command, "@Is_Completed", ParameterDirection.Input, SqlDbType.Int, 4, objSplashScreenModel.Is_Completed);
                _objSPData.AddParamToSqlCommand(command, "@Last_Modified_DateTime", ParameterDirection.Input, SqlDbType.DateTime, 20, objSplashScreenModel.Last_Modified_DateTime);
                _objSPData.AddParamToSqlCommand(command, "@Description_HTML", ParameterDirection.Input, SqlDbType.VarChar, -1, objSplashScreenModel.Description_HTML);
                SqlParameter returnValue = new SqlParameter("@Result", SqlDbType.Int);
                returnValue.Direction = ParameterDirection.Output;
                returnValue.Size      = 500;
                returnValue.Value     = "";
                command.Parameters.Add(returnValue);
                _objData.OpenConnection(companyCode);
                _objData.ExecuteNonQuery(command);
                result = Convert.ToInt32(returnValue.Value);
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
예제 #5
0
        //RegionWeekendGroupMapping

        public string RegionWeekendGroupMapping(string weekendoffCode, string regionCodes, string effectiveFrom, string effectiveTo, string status)
        {
            SPData _objSPData  = new SPData();
            string companyCode = _objCurInfo.GetCompanyCode();
            string result      = "";

            try
            {
                SqlCommand command = new SqlCommand(SP_HDWEEKENDGROUPREGIONMAPPING);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, _objCurInfo.GetCompanyCode());
                _objSPData.AddParamToSqlCommand(command, "@WeekendOffCode", ParameterDirection.Input, SqlDbType.VarChar, 30, weekendoffCode);
                _objSPData.AddParamToSqlCommand(command, "@RegionCodes", ParameterDirection.Input, SqlDbType.VarChar, regionCodes.Length, regionCodes);
                _objSPData.AddParamToSqlCommand(command, "@EffectiveFrom", ParameterDirection.Input, SqlDbType.VarChar, 30, effectiveFrom);
                _objSPData.AddParamToSqlCommand(command, "@EffectiveTo", ParameterDirection.Input, SqlDbType.VarChar, 30, effectiveTo);
                _objSPData.AddParamToSqlCommand(command, "@Status", ParameterDirection.Input, SqlDbType.Char, 1, status);

                SqlParameter returnValue = new SqlParameter("@Result", SqlDbType.VarChar);
                returnValue.Direction = ParameterDirection.Output;
                returnValue.Size      = 500;
                returnValue.Value     = "";
                command.Parameters.Add(returnValue);
                _objData.OpenConnection(companyCode);
                _objData.ExecuteNonQuery(command);
                result = returnValue.Value.ToString();
                return(result);
            }
            catch (Exception ex)
            {
                return("FAILURE:");
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
예제 #6
0
        public string ExpenseInsert(string storedProcedure, string expensetypeCode, string companyCode, string expensetypeName, string expensetypeStatus, string expenseMode,
                                    string Period, string Mode, string displayOrder)
        {
            try
            {
                DataControl.CurrentInfo objCurentInfo = new DataControl.CurrentInfo();
                //string conStr = objData.GetConnectionString(objCurentInfo.GetCompanyCode());
                //con.ConnectionString = conStr;

                DataControl.Data db = new DataControl.Data();


                // Command - specify as StoredProcedure
                SqlCommand command = new SqlCommand(storedProcedure, con);
                command.CommandType = CommandType.StoredProcedure;

                AddParamToSqlCommand(command, "@Company_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                AddParamToSqlCommand(command, "@Expense_Type_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, expensetypeCode);
                AddParamToSqlCommand(command, "@Expense_Type_Name", ParameterDirection.Input, SqlDbType.VarChar, 50, expensetypeName);
                AddParamToSqlCommand(command, "@Expense_Type_Status", ParameterDirection.Input, SqlDbType.VarChar, 30, expensetypeStatus);
                AddParamToSqlCommand(command, "@Expense_Mode", ParameterDirection.Input, SqlDbType.VarChar, 30, expenseMode);
                AddParamToSqlCommand(command, "@Expense_Period", ParameterDirection.Input, SqlDbType.VarChar, 30, Period);
                AddParamToSqlCommand(command, "@Mode", ParameterDirection.Input, SqlDbType.VarChar, 30, Mode);
                AddParamToSqlCommand(command, "@DisplayOrder", ParameterDirection.Input, SqlDbType.VarChar, 30, displayOrder);


                // Return value as parameter
                SqlParameter returnValue = new SqlParameter("@Result", SqlDbType.VarChar);
                returnValue.Direction = ParameterDirection.Output;
                returnValue.Size      = 500;
                command.Parameters.Add(returnValue);

                if (db.OpenConnection(objCurentInfo.GetCompanyCode()))
                {
                    // Execute the stored procedure
                    db.ExecuteNonQuery(command);
                    db.CloseConnection();
                }

                //For Handle the Error

                return(returnValue.Value.ToString());
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex, "ExpenseInsert()");
                return("ERROR");
            }
        }
예제 #7
0
        public string Inward(string storedProcedure, string companyCode, string UserCode, string ProductCode, string InwardDate, string Inwardstock, string UserInwardCode, string UserInwarddetails, string CurrentStock)
        {
            try
            {
                DataControl.CurrentInfo objCurentInfo = new DataControl.CurrentInfo();
                //string conStr = objData.GetConnectionString(objCurentInfo.GetCompanyCode());
                //con.ConnectionString = conStr;

                DataControl.Data db = new DataControl.Data();


                // Command - specify as StoredProcedure
                SqlCommand command = new SqlCommand(storedProcedure, con);
                command.CommandType = CommandType.StoredProcedure;

                AddParamToSqlCommand(command, "@Company_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                AddParamToSqlCommand(command, "@User_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, UserCode);
                AddParamToSqlCommand(command, "@Product_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, ProductCode);
                AddParamToSqlCommand(command, "@Inward_Date", ParameterDirection.Input, SqlDbType.VarChar, 30, InwardDate);
                AddParamToSqlCommand(command, "@Inward_stock", ParameterDirection.Input, SqlDbType.VarChar, 30, Inwardstock);
                AddParamToSqlCommand(command, "@User_Inward_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, UserInwardCode);
                AddParamToSqlCommand(command, "@User_Inward_Detail", ParameterDirection.Input, SqlDbType.VarChar, 30, UserInwarddetails);
                AddParamToSqlCommand(command, "@Current_Stock", ParameterDirection.Input, SqlDbType.VarChar, 30, CurrentStock);
                // Return value as parameter
                SqlParameter returnValue = new SqlParameter("@Result", SqlDbType.VarChar);
                returnValue.Direction = ParameterDirection.Output;
                returnValue.Size      = 500;
                command.Parameters.Add(returnValue);

                if (db.OpenConnection(objCurentInfo.GetCompanyCode()))
                {
                    // Execute the stored procedure
                    db.ExecuteNonQuery(command);
                    db.CloseConnection();
                }

                //For Handle the Error

                return(returnValue.Value.ToString());
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex, "Inward()");
                return("ERROR");
            }
        }
예제 #8
0
        public string productInsert(string storedProcedure, string companyCode, string salesproductCode, string mappingproductCode, string effectiveFrom, string createdDate, string createdBy, string recordStatus)
        {
            try
            {
                DataControl.CurrentInfo objCurentInfo = new DataControl.CurrentInfo();
                //string conStr = objData.GetConnectionString(objCurentInfo.GetCompanyCode());
                //con.ConnectionString = conStr;

                DataControl.Data db = new DataControl.Data();


                // Command - specify as StoredProcedure
                SqlCommand command = new SqlCommand(storedProcedure, con);
                command.CommandType = CommandType.StoredProcedure;

                AddParamToSqlCommand(command, "@Company_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                AddParamToSqlCommand(command, "@Sales_Product_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, salesproductCode);
                AddParamToSqlCommand(command, "@Mapping_Product_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, mappingproductCode);
                AddParamToSqlCommand(command, "@Effective_From", ParameterDirection.Input, SqlDbType.VarChar, 30, effectiveFrom);
                AddParamToSqlCommand(command, "@Created_Date", ParameterDirection.Input, SqlDbType.VarChar, 30, createdDate);
                AddParamToSqlCommand(command, "@Created_By", ParameterDirection.Input, SqlDbType.VarChar, 30, createdBy);
                AddParamToSqlCommand(command, "@Record_Status", ParameterDirection.Input, SqlDbType.VarChar, 1, recordStatus);
                // Return value as parameter
                SqlParameter returnValue = new SqlParameter("@Result", SqlDbType.VarChar);
                returnValue.Direction = ParameterDirection.Output;
                returnValue.Size      = 500;
                command.Parameters.Add(returnValue);

                if (db.OpenConnection(objCurentInfo.GetCompanyCode()))
                {
                    // Execute the stored procedure
                    db.ExecuteNonQuery(command);
                    db.CloseConnection();
                }

                //For Handle the Error

                return(returnValue.Value.ToString());
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex, "productInsert()");
                return("ERROR");
            }
        }