Ejemplo n.º 1
0
        public int UpdateLeaveType(string CompanyCode, string LeaveTypeCode, string LeaveTypeName, string updatedBy, string updatedDate, string payrollleavetypeCode, string IsLop)
        {
            try
            {
                _objSPData = new SPData();
                _objData   = new Data();
                SqlCommand command = new SqlCommand(SP_HD_UpdateLeaveType);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, CompanyCode);
                _objSPData.AddParamToSqlCommand(command, "@LeaveTypeCode", ParameterDirection.Input, SqlDbType.VarChar, 30, LeaveTypeCode);
                _objSPData.AddParamToSqlCommand(command, "@LeaveTypeName", ParameterDirection.Input, SqlDbType.VarChar, 30, LeaveTypeName);
                _objSPData.AddParamToSqlCommand(command, "@UpdatedBy", ParameterDirection.Input, SqlDbType.VarChar, 10, updatedBy);
                _objSPData.AddParamToSqlCommand(command, "@UpdatedDate", ParameterDirection.Input, SqlDbType.VarChar, 10, updatedDate);
                _objSPData.AddParamToSqlCommand(command, "@PayrollleavetypeCode", ParameterDirection.Input, SqlDbType.VarChar, 30, payrollleavetypeCode);
                _objSPData.AddParamToSqlCommand(command, "@IsLOP", ParameterDirection.Input, SqlDbType.VarChar, 10, IsLop);
                _objData.OpenConnection(CompanyCode);
                string returnvale = _objData.ExecuteScalar(command).ToString();
                _objData.CloseConnection();
                return(Convert.ToInt32(returnvale));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public string GetAttendanceDetail(string companyCode, string userCode, string dcrDate)
        {
            string result     = string.Empty;
            SPData _objSPData = new SPData();
            Data   _objData   = new Data();

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

                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@UserCode", ParameterDirection.Input, SqlDbType.VarChar, 30, userCode);
                _objSPData.AddParamToSqlCommand(command, "@DCRDate", ParameterDirection.Input, SqlDbType.VarChar, 15, dcrDate);

                _objData.OpenConnection(companyCode);
                result = Convert.ToString(_objData.ExecuteScalar(command));
                return(result);
            }
            catch
            {
                throw;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Ejemplo n.º 3
0
        public bool IsEDAvailable(string companyCode, string userTypeCode)
        {
            try
            {
                int        count   = 0;
                SqlCommand command = new SqlCommand(SPEDCHECKEDACCESS);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@UserTypeCode", ParameterDirection.Input, SqlDbType.VarChar, 30, userTypeCode);

                _objData.OpenConnection();
                count = (int)_objData.ExecuteScalar(command);

                if (count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Ejemplo n.º 4
0
        public string InsertBrand(FormCollection collection)
        {
            string result = "";

            DataControl.Data ds = new DataControl.Data();
            try
            {
                DataSet dsTrans = new DataSet();

                ds.OpenConnection(objCurInfo.GetCompanyCode());
                {
                    string CompanyCode = objCurInfo.GetCompanyCode();
                    string BrandName   = collection["BrandName"].ToString();
                    string BrandCode   = collection["BrandCode"].ToString();
                    string Mode        = collection["Mode"].ToString();
                    string strSQL      = "EXEC sp_sdInsertBrand '" + CompanyCode + "','" + BrandName + "','" + BrandCode + "','" + Mode + "'";
                    result = (string)ds.ExecuteScalar(strSQL);
                }
                return(result);
            }
            finally
            {
                ds.CloseConnection();
            }
        }
Ejemplo n.º 5
0
        public string UserProductMap(FormCollection collection)
        {
            string str = "";

            try
            {
                string Emp_No          = collection["Emp_No"].ToString();
                string Product_Ref_Key = collection["Product_Ref_Key"].ToString();

                DataControl.Data ds = new DataControl.Data();
                ds.OpenConnection(_objCurrentInfo.GetCompanyCode());
                {
                    string strSQL = "";

                    strSQL = "EXEC SP_HD_InwardBulk_UserProductMap '" + Emp_No + "','" + Product_Ref_Key + "'";

                    str = ds.ExecuteScalar(strSQL).ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(str);
        }
Ejemplo n.º 6
0
        public string GetHolidayCount(FormCollection collection)
        {
            try
            {
                string        result    = string.Empty;
                BLRegion      objRegion = new BLRegion();
                JSONConverter objJson   = new JSONConverter();

                string fromDate    = collection["fromDate"].ToString();
                string toDate      = collection["toDate"].ToString();
                string companyCode = _objCurr.GetCompanyCode();

                _objData.OpenConnection(companyCode);
                {
                    result = Convert.ToString(_objData.ExecuteScalar("exec SP_hdGetHolidayCount '" + companyCode + "','" + _objCurr.GetUserCode() + "','" + fromDate + "','" + toDate + "','" + _objCurr.GetRegionCode() + "'"));
                }

                #region WeekendDays
                List <MVCModels.HiDoctor_Master.WeekendDaysForARegion> lstWeekend = new List <MVCModels.HiDoctor_Master.WeekendDaysForARegion>();
                lstWeekend = objRegion.GetWeekendDaysForARegion(companyCode, _objCurr.GetRegionCode(), fromDate, toDate);
                #endregion WeekendDays

                return(result + "$" + objJson.Serialize(lstWeekend));
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Ejemplo n.º 7
0
        public int InsertUserLeaveTypeMaster(string Company_Code, string Effective_From, string Effective_To, string IS_Added_Weekend_Holiday,
                                             string IS_Added_Holiday, string Leave_Type_Code, string Min_Leave, string Max_Leave, string User_Code, string User_Type_Code,
                                             string Created_By, string Created_Date, string User_Leave_Status, string Updated_By, string Updated_Date,
                                             string User_Leave_Type_Code, string clubbing, int leaveeligible, string leaveconfirmation, string leaveoncompletion, int noofdays, int applicdays, string validation_Mode, string leave_Occurrence_Count, string leave_Max_Count, string Document_Upload, string consecutvie_Leave_Allowed, string mode)
        {
            //int rowsAffected = 0;
            try
            {
                _objSPData = new SPData();
                _objData   = new Data();
                SqlCommand command = new SqlCommand(SP_HD_InsertUserLeaveTypeMapping);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@Company_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, Company_Code);
                _objSPData.AddParamToSqlCommand(command, "@Effective_From", ParameterDirection.Input, SqlDbType.VarChar, 30, Effective_From);
                _objSPData.AddParamToSqlCommand(command, "@Effective_To", ParameterDirection.Input, SqlDbType.VarChar, 30, Effective_To);
                _objSPData.AddParamToSqlCommand(command, "@IS_Added_Weekend_Holiday", ParameterDirection.Input, SqlDbType.VarChar, 1, IS_Added_Weekend_Holiday);
                _objSPData.AddParamToSqlCommand(command, "@IS_Added_Holiday", ParameterDirection.Input, SqlDbType.VarChar, 1, IS_Added_Holiday);
                _objSPData.AddParamToSqlCommand(command, "@Leave_Type_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, Leave_Type_Code);
                _objSPData.AddParamToSqlCommand(command, "@Min_Leave", ParameterDirection.Input, SqlDbType.VarChar, 8, Min_Leave);
                _objSPData.AddParamToSqlCommand(command, "@Max_Leave", ParameterDirection.Input, SqlDbType.VarChar, 8, Max_Leave);
                _objSPData.AddParamToSqlCommand(command, "@User_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, User_Code);
                _objSPData.AddParamToSqlCommand(command, "@User_Type_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, User_Type_Code);
                _objSPData.AddParamToSqlCommand(command, "@User_Leave_Type_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, User_Leave_Type_Code);
                _objSPData.AddParamToSqlCommand(command, "@User_Leave_Status", ParameterDirection.Input, SqlDbType.VarChar, 30, User_Leave_Status);
                _objSPData.AddParamToSqlCommand(command, "@Created_By", ParameterDirection.Input, SqlDbType.VarChar, 30, Created_By);
                _objSPData.AddParamToSqlCommand(command, "@Created_Date", ParameterDirection.Input, SqlDbType.VarChar, 30, Created_Date);
                _objSPData.AddParamToSqlCommand(command, "@Updated_By", ParameterDirection.Input, SqlDbType.VarChar, 30, Updated_By);
                _objSPData.AddParamToSqlCommand(command, "@Updated_Date", ParameterDirection.Input, SqlDbType.VarChar, 30, Updated_Date);
                _objSPData.AddParamToSqlCommand(command, "@clubbing", ParameterDirection.Input, SqlDbType.VarChar, 200, clubbing);
                _objSPData.AddParamToSqlCommand(command, "@leaveeligible", ParameterDirection.Input, SqlDbType.Int, 32, leaveeligible);
                _objSPData.AddParamToSqlCommand(command, "@leaveconfirmation", ParameterDirection.Input, SqlDbType.VarChar, 10, leaveconfirmation);
                _objSPData.AddParamToSqlCommand(command, "@leaveoncompletion", ParameterDirection.Input, SqlDbType.VarChar, 10, leaveoncompletion);
                _objSPData.AddParamToSqlCommand(command, "@noofdays", ParameterDirection.Input, SqlDbType.Int, 32, noofdays);
                _objSPData.AddParamToSqlCommand(command, "@applicdays", ParameterDirection.Input, SqlDbType.Int, 32, applicdays);
                _objSPData.AddParamToSqlCommand(command, "@Validation_Mode", ParameterDirection.Input, SqlDbType.VarChar, 1, validation_Mode);
                _objSPData.AddParamToSqlCommand(command, "@Leave_Occurrence_Count", ParameterDirection.Input, SqlDbType.VarChar, 10, leave_Occurrence_Count);
                _objSPData.AddParamToSqlCommand(command, "@Leave_Max_Count", ParameterDirection.Input, SqlDbType.VarChar, 10, leave_Max_Count);
                _objSPData.AddParamToSqlCommand(command, "@Document_Upload", ParameterDirection.Input, SqlDbType.VarChar, 10, Document_Upload);
                _objSPData.AddParamToSqlCommand(command, "@Consecutvie_Leave_Allowed", ParameterDirection.Input, SqlDbType.VarChar, 10, consecutvie_Leave_Allowed);
                _objSPData.AddParamToSqlCommand(command, "@mode", ParameterDirection.Input, SqlDbType.VarChar, 30, mode);
                _objData.OpenConnection(Company_Code);
                string returnvalue = _objData.ExecuteScalar(command).ToString();
                _objData.CloseConnection();
                return(Convert.ToInt32(returnvalue));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 8
0
 private string GetNextTwoPossibleDays(string dcrDate)
 {
     try
     {
         string possibleDays = string.Empty;
         objData.OpenConnection(objCurr.GetCompanyCode());
         {
             possibleDays = Convert.ToString(objData.ExecuteScalar("exec SP_hdGetNextTwoPossibleDays '" + objCurr.GetCompanyCode() + "','" + objCurr.GetUserCode() + "','" + objCurr.GetRegionCode() + "','" + dcrDate + "'"));
         }
         return(possibleDays);
     }
     finally
     {
         objData.CloseConnection();
     }
 }
Ejemplo n.º 9
0
 public string InsertSpeciality(FormCollection collection)
 {
     DataControl.Data ds = new DataControl.Data();
     try
     {
         string  result  = "";
         DataSet dsTrans = new DataSet();
         ds.OpenConnection(objCurInfo.GetCompanyCode());
         {
             string strSQL = "EXEC sp_sdInsertSpeciality '" + objCurInfo.GetCompanyCode() + "','" + collection["SpecialityName"].ToString() + "','" + collection["SpecialityCount"].ToString() + "','" + collection["SpecialityCode"].ToString() + "','" + collection["Mode"].ToString() + "'";
             result = (string)ds.ExecuteScalar(strSQL);
         }
         return(result);
     }
     finally
     {
         ds.CloseConnection();
     }
 }
Ejemplo n.º 10
0
 public int CheckKangleAccess()
 {
     try
     {
         string str = "";
         SqlCommand command = new SqlCommand(SP_HD_KANGLE_CHECKACCESS);
         command.CommandType = CommandType.StoredProcedure;
         _ObjData.OpenConnection();
         str =  _ObjData.ExecuteScalar(command).ToString();
         if (str == "YES")
             return 1;
         else
             return 0;
     }
     catch(Exception ex)
     {
         return 0;
     }
 }
Ejemplo n.º 11
0
        public int CheckItranProduct(FormCollection collection)
        {
            DataControl.Data ds = new DataControl.Data();
            try
            {
                int count = 0;

                DataSet dsTrans = new DataSet();
                ds.OpenConnection(objCurInfo.GetCompanyCode());
                {
                    string strSQL = "EXEC sp_sdCheckItranProduct '" + objCurInfo.GetCompanyCode() + "','" + collection["ProductCode"].ToString() + "'";
                    count = (int)ds.ExecuteScalar(strSQL);
                }
                return(count);
            }
            finally
            {
                ds.CloseConnection();
            }
        }
Ejemplo n.º 12
0
        public string BatchAutoCreate(FormCollection collection)
        {
            string ProductCode = collection["ProductCode"].ToString();
            string User_Code   = objCurInfo.GetUserCode();

            DataControl.Data ds = new DataControl.Data();
            try
            {
                string str = "";
                ds.OpenConnection(objCurInfo.GetCompanyCode());
                {
                    string strSQL = "EXEC SP_HD_ProductBatchMigrate '" + ProductCode + "','" + User_Code + "'";
                    str = ds.ExecuteScalar(strSQL).ToString();
                }
                return(str);
            }
            finally
            {
                ds.CloseConnection();
            }
        }
Ejemplo n.º 13
0
        public string ChangeBatchStatus(FormCollection collection)
        {
            string mappingId = collection["MappingId"].ToString();
            string Status    = collection["Status"].ToString();
            string User_Code = objCurInfo.GetUserCode();

            DataControl.Data ds = new DataControl.Data();
            try
            {
                string str = "";
                ds.OpenConnection(objCurInfo.GetCompanyCode());
                {
                    string strSQL = "EXEC SP_HD_UPD_BatchStatus " + mappingId.ToString() + "," + Status.ToString() + ",'" + User_Code + "'";
                    str = ds.ExecuteScalar(strSQL).ToString();
                }
                return(str);
            }
            finally
            {
                ds.CloseConnection();
            }
        }
Ejemplo n.º 14
0
        public string SaveBatch(FormCollection collection)
        {
            string ProductCode    = collection["ProductCode"].ToString();
            string BatchNumber    = collection["Batch_Number"].ToString();
            string ExpiryDate     = collection["Expiry_Date"].ToString();
            string Effective_From = collection["Effective_From"].ToString();
            string Effective_To   = collection["Effective_To"].ToString();
            string User_Code      = objCurInfo.GetUserCode();
            string Merge_Qty      = collection["MergeQty"].ToString();
            int    Mode           = Convert.ToInt32(collection["Mode"].ToString());
            int    MappingId      = Convert.ToInt32(collection["MappingId"].ToString() == "" ? "0" : collection["MappingId"].ToString());

            DataControl.Data ds = new DataControl.Data();
            try
            {
                string str = "";
                ds.OpenConnection(objCurInfo.GetCompanyCode());
                {
                    string strSQL = "";
                    if (Mode == 0)
                    {
                        strSQL = "EXEC SP_HD_INS_ProductBatch '" + ProductCode + "','" + BatchNumber + "','" + ExpiryDate + "','" + Effective_From + "','" + Effective_To + "','" + User_Code + "','" + Merge_Qty + "'";
                    }
                    else if (Mode == 1)
                    {
                        strSQL = "EXEC SP_HD_UPD_ProductBatch " + MappingId + ",'" + ExpiryDate + "','" + Effective_To + "'";
                    }


                    str = ds.ExecuteScalar(strSQL).ToString();
                }
                return(str);
            }
            finally
            {
                ds.CloseConnection();
            }
        }
Ejemplo n.º 15
0
        public string GetExpenseGroupMaxID(FormCollection coll)
        {
            try
            {
                string expenseID = string.Empty;

                _objData.OpenConnection(_objCurr.GetCompanyCode());
                {
                    expenseID = Convert.ToString(_objData.ExecuteScalar("exec SP_hdGetExpenseGroupMaxID '" + _objCurr.GetCompanyCode() + "'"));
                }


                return(expenseID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Ejemplo n.º 16
0
        public string ProductBatchMap(FormCollection collection)
        {
            string str = "";

            try
            {
                string Product_Ref_Key = collection["Product_Ref_Key"].ToString();
                string Batch_Number    = collection["Batch_Number"].ToString();
                string user_code       = _objCurrentInfo.GetUserCode();

                DataControl.Data ds = new DataControl.Data();
                ds.OpenConnection(_objCurrentInfo.GetCompanyCode());
                {
                    string strSQL = "";
                    strSQL = "EXEC SP_HD_InwardBulk_ProductBatchMap '" + Product_Ref_Key + "','" + Batch_Number + "','" + user_code + "'";
                    str    = ds.ExecuteScalar(strSQL).ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(str);
        }
Ejemplo n.º 17
0
        public string ChangeProductStatus(FormCollection collection)
        {
            DataControl.Data ds     = new DataControl.Data();
            string           result = string.Empty;

            try
            {
                DataSet dsTrans = new DataSet();
                ds.OpenConnection(objCurInfo.GetCompanyCode());
                {
                    string strSQL = "EXEC sp_sdChangeProductStatus '" + objCurInfo.GetCompanyCode() + "','" + collection["ProductCode"].ToString() + "'";
                    result = (string)ds.ExecuteScalar(strSQL);
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(ex.Message.ToString());
            }
            finally
            {
                ds.CloseConnection();
            }
        }
Ejemplo n.º 18
0
        public double GetExpenseSum(string dcrActualDate, string mode, string expenseTypeCode)
        {
            try
            {
                DateTime dcrDate = new DateTime();
                double   sum = 0.0;
                string   fromDate = string.Empty, toDate = string.Empty;
                int      startDay = 0, endDay = 0;

                string expenseMode = mode.ToUpper();
                dcrDate = Convert.ToDateTime(dcrActualDate);

                switch (expenseMode)
                {
                case "MONTHLY":
                    startDay = 1;
                    endDay   = DateTime.DaysInMonth(dcrDate.Year, dcrDate.Month);

                    fromDate = Convert.ToString(dcrDate.Year.ToString() + "-" + dcrDate.Month.ToString() + "-" + startDay.ToString());
                    toDate   = Convert.ToString(dcrDate.Year.ToString() + "-" + dcrDate.Month.ToString() + "-" + endDay.ToString());
                    sum      = GetSum(fromDate, toDate, expenseTypeCode);
                    break;

                case "YEARLY":
                    fromDate = Convert.ToString(dcrDate.Year.ToString() + "-01-01");
                    toDate   = Convert.ToString(dcrDate.Year.ToString() + "-12-31");
                    sum      = GetSum(fromDate, toDate, expenseTypeCode);
                    break;

                case "WEEKLY":
                    objData.OpenConnection(objCurr.GetCompanyCode());
                    {
                        sum = Convert.ToDouble(objData.ExecuteScalar("exec SP_hdGetWeeklyExpenseSum '" + objCurr.GetCompanyCode() + "','" + objCurr.GetUserCode() + "','" + dcrDate + "','" + expenseTypeCode + "'"));
                    }
                    objData.CloseConnection();
                    break;

                //case "FORTNIGHTLY":
                //    if (dcrDate.Day > 15)
                //    {
                //        startDay = 16;
                //        endDay = DateTime.DaysInMonth(dcrDate.Year, dcrDate.Month);
                //    }
                //    else
                //    {
                //        startDay = 1;
                //        endDay = 15;
                //    }
                //    fromDate = Convert.ToString(dcrDate.Year.ToString() + "-" + dcrDate.Month.ToString() + "-" + startDay.ToString());
                //    toDate = Convert.ToString(dcrDate.Year.ToString() + "-" + dcrDate.Month.ToString() + "-" + endDay.ToString());
                //    sum = GetSum(fromDate, toDate, expenseTypeCode);
                //    break;
                default:
                    break;
                }
                return(sum);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 19
0
        public string ChangeStatus(FormCollection collection)
        {
            try
            {
                //Added DCR History details for Mobile
                BLApproval  _objApproval    = new BLApproval();
                DALApproval _objDALApproval = new DALApproval();
                string      leaveEntry      = collection["LeaveValidation"].ToString();
                string      remarks         = collection["Remarks"].ToString();
                string      status          = collection["Status"].ToString();
                string      dcrCode         = collection["DCRCode"].ToString();
                string      flag            = collection["Flag"].ToString();
                string      leaveType       = collection["LeaveTypeName"].ToString();
                string      userCode        = collection["UserCode"].ToString();
                string      calcFields      = collection["CalcFields"].ToString();
                string      DCR_ENTRY_UNAPPROVED_ACTIVITY_LOCK = collection["DCR_ENTRY_UNAPPROVED_ACTIVITY_LOCK"].ToString();
                string      dcr_Actual_Date = collection["DCR_Actual_Date"].ToString();
                string      twoActivityExpenseValidation = collection["twoActivityExpenseValidation"].ToString();
                string      fareDailyAllowance           = collection["fareDailyAllowance"].ToString();

                string calcFieldStatus = calcFields.ToUpper() == "APPLIED" ? "1" : "2";


                string[] privValues;
                //   string leaveTypeName = "";
                //   bool isCurBalanceNeed = false;
                //   double dblLeaveBalance = 0.0;

                string dcrStatus;
                int    CurrexpenseClaimValidation = 0;

                privValues = leaveEntry.Split(',');

                if (status == "0")
                {
                    if (string.IsNullOrEmpty(remarks))
                    {
                        return("FAIL:Reason must be given for unapproval");
                    }
                }

                if (twoActivityExpenseValidation.ToUpper() != "NO" && fareDailyAllowance != "" && flag != "L" && status == "0")
                {
                    string twoActivityDCRApproval = _objDALApproval.GetTwoActivityDCRApproval(dcrCode, flag, fareDailyAllowance);

                    objData.OpenConnection(_objCurrentInfo.GetCompanyCode());
                    {
                        dcrStatus = (string)objData.ExecuteScalar("exec SP_hdGetDCRStatus '" + _objCurrentInfo.GetCompanyCode() + "','" + dcrCode + "','" + flag + "'");
                    }
                    if (dcrStatus == "2")
                    {
                        CurrexpenseClaimValidation = _objDALApproval.CheckExpenseClaim(_objCurrentInfo.GetCompanyCode(), userCode, dcrCode, flag, dcr_Actual_Date);
                        if (CurrexpenseClaimValidation > 0)
                        {
                            return("FAIL:You Cannot Unapprove the DCR-" + dcr_Actual_Date + "  " + ((flag == "F") ? "Field" : ((flag == "A") ? "Attendace" : "Leave")) + " as the expenses are claimed in expenses claim");
                        }
                        string expenseClaimValidation = _objDALApproval.CheckDayExpenseClaim(dcrCode, flag);
                        if (expenseClaimValidation != "")
                        {
                            return("FAIL:You Cannot Unapprove the other DCR-" + expenseClaimValidation.Split('|')[0] + "  " + ((expenseClaimValidation.Split('|')[1] == "F") ? "Field" : ((expenseClaimValidation.Split('|')[1] == "A") ? "Attendace" : "Leave")) + " as the expenses are claimed in expenses claim");
                        }
                    }

                    if (twoActivityDCRApproval != "")
                    {
                        string TwoActivitydcrCode      = twoActivityDCRApproval.Split('|')[0];
                        string TwoActivityflag         = twoActivityDCRApproval.Split('|')[1];
                        string TwoActivitydcrStatusOld = twoActivityDCRApproval.Split('|')[2];
                        // dcrStatusOld = ((dcrStatusOld == "Applied") ? "1" : "0");
                        string TwoActivityoldReason     = twoActivityDCRApproval.Split('|')[3];
                        string TwoActivityleaveTypeName = twoActivityDCRApproval.Split('|')[4];
                        string TwoActivitydcrDate       = twoActivityDCRApproval.Split('|')[5];


                        objData.OpenConnection(_objCurrentInfo.GetCompanyCode());
                        {
                            dcrStatus = (string)objData.ExecuteScalar("exec SP_hdGetDCRStatus '" + _objCurrentInfo.GetCompanyCode() + "','" + TwoActivitydcrCode + "','" + TwoActivityflag + "'");
                        }

                        if (dcrStatus == "1" || dcrStatus == "2") // Applied and Approved
                        {
                            objData.OpenConnection(_objCurrentInfo.GetCompanyCode());
                            {
                                objData.ExecuteNonQuery("exec SP_hdUpdateDCRApproval '" + _objCurrentInfo.GetCompanyCode() + "','" + TwoActivitydcrCode + "','" + TwoActivityflag + "','" + status + "','" + _objCurrentInfo.GetUserName() + "','" + DateTime.Now.ToString() + "','" + remarks + "','" + TwoActivitydcrStatusOld + "','" + userCode + "'");
                            }
                            int firstexpenseRowCount = 0;
                            firstexpenseRowCount = _objDALApproval.DeleteDCRExpense(TwoActivityflag, TwoActivitydcrCode, fareDailyAllowance);

                            if (DCR_ENTRY_UNAPPROVED_ACTIVITY_LOCK.ToUpper().Trim() == "ENABLED")
                            {
                                IDCRLock objDCRLock = new BLDCRLock();
                                List <DCRActivityLockModel> lstDCRActivityLockModel = new List <DCRActivityLockModel>();

                                DCRActivityLockModel dcrActivityLockModel = new DCRActivityLockModel();
                                string comany_Code = _objCurrentInfo.GetCompanyCode();
                                dcrActivityLockModel.User_Code       = userCode;
                                dcrActivityLockModel.DCR_Actual_Date = dcr_Actual_Date;
                                dcrActivityLockModel.Activity_Flag   = TwoActivityflag;
                                dcrActivityLockModel.Locked_Date     = DateTime.Now.ToShortDateString();
                                lstDCRActivityLockModel.Add(dcrActivityLockModel);
                                int result = objDCRLock.InsertActivityLock(comany_Code, lstDCRActivityLockModel);
                            }
                            int result_History = _objApproval.InsertDcrHistory(_objCurrentInfo.GetCompanyCode(), TwoActivitydcrCode, TwoActivityflag);
                        }
                        else
                        {
                            return("FAIL:You cannot change the status of Unapproved DCRs.");
                        }
                    }
                }

                objData.OpenConnection(_objCurrentInfo.GetCompanyCode());
                {
                    dcrStatus = (string)objData.ExecuteScalar("exec SP_hdGetDCRStatus '" + _objCurrentInfo.GetCompanyCode() + "','" + dcrCode + "','" + flag + "'");
                }

                if (dcrStatus == "1" || dcrStatus == "2") // Applied and Approved
                {
                    //START: The Leave entry validation finctionality commented as per Customer Service Request.
                    //if (flag == "L")
                    // {
                    //leaveTypeName = leaveType;

                    //isCurBalanceNeed = false;

                    //for (int j = 0; j < privValues.Length; j++)
                    //{
                    //    if (privValues[j].ToString().Trim().ToUpper() == leaveTypeName.ToUpper())
                    //    {
                    //        isCurBalanceNeed = true;
                    //        break;
                    //    }
                    //}

                    //dblLeaveBalance = 0.0;

                    //if (isCurBalanceNeed)
                    //{
                    //    objData.OpenConnection(_objCurrentInfo.GetCompanyCode());
                    //    {
                    //        object leaveBal = objData.ExecuteScalar("exec SP_hdGetLeaveBalance '" + _objCurrentInfo.GetCompanyCode() + "','" + dcrCode + "','" + userCode + "'");
                    //        if (leaveBal.ToString() != "" && leaveBal != null)
                    //        {
                    //            if (!string.IsNullOrEmpty(leaveBal.ToString()))
                    //            {
                    //                dblLeaveBalance = float.Parse(leaveBal.ToString());
                    //            }
                    //        }
                    //    }

                    //    if (dblLeaveBalance > 0)
                    //    {
                    //        objData.OpenConnection(_objCurrentInfo.GetCompanyCode());
                    //        {
                    //            objData.ExecuteNonQuery("exec SP_hdUpdateDCRApproval '" + _objCurrentInfo.GetCompanyCode() + "','" + dcrCode + "','" + flag + "','" + status + "','" + _objCurrentInfo.GetUserName() + "','" + DateTime.Now.ToString() + "','" + remarks + "','" + calcFieldStatus + "','" + userCode + "'");
                    //        }
                    //        objData.OpenConnection(_objCurrentInfo.GetCompanyCode());
                    //        {
                    //            objData.ExecuteNonQuery("exec SP_hdUpdateUserLeaveCurBalance '" + _objCurrentInfo.GetCompanyCode() + "','" + dcrCode + "','" + flag + "','" + userCode + "','" + dcrStatus + "','" + status + "'");
                    //        }
                    //    }
                    //    else if (status == "0")
                    //    {
                    //        objData.OpenConnection(_objCurrentInfo.GetCompanyCode());
                    //        {
                    //            objData.ExecuteNonQuery("exec SP_hdUpdateDCRApproval '" + _objCurrentInfo.GetCompanyCode() + "','" + dcrCode + "','" + flag + "','" + status + "','" + _objCurrentInfo.GetUserName() + "','" + DateTime.Now.ToString() + "','" + remarks + "','" + calcFieldStatus + "','" + userCode + "'");
                    //        }

                    //        objData.OpenConnection(_objCurrentInfo.GetCompanyCode());
                    //        {
                    //            objData.ExecuteNonQuery("exec SP_hdUpdateUserLeaveCurBalance '" + _objCurrentInfo.GetCompanyCode() + "','" + dcrCode + "','" + flag + "','" + userCode + "','" + dcrStatus + "','" + status + "'");
                    //        }
                    //    }
                    //    else
                    //    {
                    //        return "FAIL:Due to insufficient leave balance, unable to approve leave for " + leaveTypeName + "";
                    //    }
                    //}
                    //else
                    //{
                    //    objData.OpenConnection(_objCurrentInfo.GetCompanyCode());
                    //  {
                    //    objData.ExecuteNonQuery("exec SP_hdUpdateDCRApproval '" + _objCurrentInfo.GetCompanyCode() + "','" + dcrCode + "','" + flag + "','" + status + "','" + _objCurrentInfo.GetUserName() + "','" + DateTime.Now.ToString() + "','" + remarks + "','" + calcFieldStatus + "','" + userCode + "'");
                    //}
                    //}
                    //}
                    //END: The Leave entry validation finctionality commented as per Customer Service Request.

                    objData.OpenConnection(_objCurrentInfo.GetCompanyCode());
                    {
                        objData.ExecuteNonQuery("exec SP_hdUpdateDCRApproval '" + _objCurrentInfo.GetCompanyCode() + "','" + dcrCode + "','" + flag + "','" + status + "','" + _objCurrentInfo.GetUserName() + "','" + DateTime.Now.ToString() + "','" + remarks + "','" + calcFieldStatus + "','" + userCode + "'");
                    }
                    if (flag.ToUpper() != "L" && status == "0")
                    {
                        int secondexpenseRowCount = 0;
                        secondexpenseRowCount = _objDALApproval.DeleteDCRExpense(flag, dcrCode, fareDailyAllowance);
                    }

                    if (DCR_ENTRY_UNAPPROVED_ACTIVITY_LOCK.ToUpper().Trim() == "ENABLED")
                    {
                        IDCRLock objDCRLock = new BLDCRLock();
                        List <DCRActivityLockModel> lstDCRActivityLockModel = new List <DCRActivityLockModel>();

                        DCRActivityLockModel dcrActivityLockModel = new DCRActivityLockModel();
                        string comany_Code = _objCurrentInfo.GetCompanyCode();
                        dcrActivityLockModel.User_Code       = userCode;
                        dcrActivityLockModel.DCR_Actual_Date = dcr_Actual_Date;
                        dcrActivityLockModel.Activity_Flag   = flag;
                        dcrActivityLockModel.Locked_Date     = DateTime.Now.ToShortDateString();
                        lstDCRActivityLockModel.Add(dcrActivityLockModel);
                        int result = objDCRLock.InsertActivityLock(comany_Code, lstDCRActivityLockModel);
                        if (result > 0)
                        {
                            return("SUCCESS:Status Changed Successfully. But Insert Activity Lock Fail.");
                        }
                    }
                    int result_History = _objApproval.InsertDcrHistory(_objCurrentInfo.GetCompanyCode(), dcrCode, flag);
                }
                else
                {
                    return("FAIL:You cannot change the status of Unapproved DCRs.");
                }

                return("SUCCESS:Status Changed Successfully");
            }
            finally
            {
                objData.CloseConnection();
            }
        }
Ejemplo n.º 20
0
        //save functionality//
        public string save(FormCollection collection)
        {
            string Result = string.Empty;
            string UserCode = string.Empty;
            string SelectDate = string.Empty;
            string Content = string.Empty;
            string UserinwardCode = string.Empty;
            string UserinwardDetail = string.Empty, maxCode = string.Empty;

            UserCode   = collection["UserCode"];
            SelectDate = collection["SelectDate"];

            DataControl.Data objAppData = new DataControl.Data();
            string           queryMax   = objAppData.getSingleValue(Session["Comp_Code"].ToString(), "SELECT CONVERT(VARCHAR,MAX(CAST(SUBSTRING(User_Inward_Code,4,LEN(User_Inward_Code)) AS INT))) FROM  tbl_SFA_Inward_Stock");

            maxCode = getMaxCode(Convert.ToInt64(queryMax), "UIC");

            string userMaxCode = objAppData.getSingleValue(Session["Comp_Code"].ToString(), "SELECT CONVERT(VARCHAR,MAX(CAST(SUBSTRING(User_Inward_Detail,4,LEN(User_Inward_Detail)) AS INT))) FROM  tbl_SFA_Inward_Details");

            UserinwardCode = maxCode;

            string[] strArr         = collection["Content"].Split('^');
            string   ProductCode    = "";
            string   InwardStock    = "";
            string   BatchNumber    = "";
            string   strSQL         = "";
            string   strSqlInward   = "";
            string   userInwardCode = "";
            string   Remarks        = "";

            //string productDetails = "";

            DataControl.Data ds = new DataControl.Data();
            ds.OpenConnection(_objCurrentInfo.GetCompanyCode());
            {
                strSQL         = "EXEC Sp_hdInwardStock_Insert " + "'" + _objCurrentInfo.GetCompanyCode() + "','" + UserCode + "','" + SelectDate + "'";
                userInwardCode = ds.ExecuteScalar(strSQL).ToString();
                ds.CloseConnection();
            }

            if (strArr.Length > 0)
            {
                for (int i = 0; i < strArr.Length; i++)
                {
                    if (strArr[i] != string.Empty)
                    {
                        //userMaxCode = (Convert.ToInt64(userMaxCode) + 1).ToString();
                        //UserinwardDetail = objAppData.getMaxValues(userMaxCode, "UDC");
                        ProductCode = strArr[i].Split('_')[0];
                        BatchNumber = strArr[i].Split('_')[1].Trim();
                        InwardStock = strArr[i].Split('_')[2];
                        Remarks     = strArr[i].Split('_')[4];

                        strSqlInward += "EXEC Sp_hdInwardDetails_Insert " + "'" + _objCurrentInfo.GetCompanyCode() + "','" + UserCode + "','" + userInwardCode + "','" + ProductCode + "','" + BatchNumber + "','" + InwardStock + "','" + Remarks + "';";
                    }
                }
            }

            ds.OpenConnection(_objCurrentInfo.GetCompanyCode());
            {
                ds.ExecuteNonQuery(strSqlInward);
                ds.CloseConnection();
            }
            return("INSERTED");
        }
Ejemplo n.º 21
0
        public JsonResult ExpenseDetails(FormCollection collection)
        {
            try
            {
                DataSet   dsExpense         = new DataSet();
                DataTable dsExpenseAutoFill = new DataTable();
                DataTable dsExpensePreFill  = new DataTable();
                string    companyCode       = _objCurr.GetCompanyCode();
                string    userTypeCode      = _objCurr.GetUserTypeCode();
                string    regionCode        = _objCurr.GetRegionCode();
                string    entity            = collection["entity"].ToString();
                string    dcrDate           = collection["dcrDate"].ToString();
                string    dcrCode           = _objCurr.GetDCRCode(dcrDate);
                string    dcrStatus         = collection["dcrStatus"].ToString();
                string    interMediatePlace = collection["InterMediate_Places_Needed"].ToString();
                double    travelKm          = Convert.ToDouble(collection["Travel_Km"]);
                string    flag           = collection["flag"].ToString();
                string    isExpenseGroup = string.Empty;

                List <Models.DCRExpenseModel> lstExpenseAuto    = new List <Models.DCRExpenseModel>();
                List <Models.DCRExpenseModel> lstExpensePre     = new List <Models.DCRExpenseModel>();
                List <Models.DCRExpenseModel> lstDraftedExpense = new List <Models.DCRExpenseModel>();

                // check whether the expense group has mapped
                try
                {
                    _objData.OpenConnection(companyCode);
                    {
                        isExpenseGroup = Convert.ToString(_objData.ExecuteScalar("exec SP_hdCheckExpenseGroupMapping '" + companyCode + "','" + _objCurr.GetUserCode() + "','" + regionCode + "'"));
                    }
                }
                finally
                {
                    _objData.CloseConnection();
                }


                if (isExpenseGroup != "NO_GROUP")
                {
                    // Get Expense Data
                    try
                    {
                        _objData.OpenConnection(companyCode);
                        {
                            dsExpense = _objData.ExecuteDataSet("exec SP_hdGetExpenseNG '" + companyCode + "','" + dcrDate + "','" + isExpenseGroup + "','" + entity + "'");
                        }
                    }
                    finally
                    {
                        _objData.CloseConnection();
                    }


                    dsExpenseAutoFill = dsExpense.Tables[0];
                    dsExpensePreFill  = GetFareCalculatedExpense(dsExpense.Tables[1], entity, dcrCode, dcrDate, interMediatePlace, travelKm, flag);
                }
                else
                {
                    //old logic
                    // Get Expense data
                    try
                    {
                        _objData.OpenConnection(companyCode);
                        {
                            dsExpense = _objData.ExecuteDataSet("exec SP_hdGetExpense '" + companyCode + "','" + regionCode + "','" + userTypeCode + "','" + entity + "'");
                        }
                    }
                    finally
                    {
                        _objData.CloseConnection();
                    }


                    // auto fill Data
                    dsExpenseAutoFill = GetExpenseData(dsExpense.Tables[0], "A", entity, dcrCode, dcrDate, interMediatePlace, travelKm, flag);

                    // PrefillData
                    dsExpensePreFill = GetExpenseData(dsExpense.Tables[1], "P", entity, dcrCode, dcrDate, interMediatePlace, travelKm, flag);
                }

                if (dcrStatus == "3" || dcrStatus == "0")
                {
                    DataSet dsDraftedExpense = new DataSet();
                    string  userCode         = _objCurr.GetUserCode();

                    // Get Expense  Drafted item
                    try
                    {
                        _objData.OpenConnection(companyCode);
                        {
                            dsDraftedExpense = _objData.ExecuteDataSet("exec SP_hdGetDraftedExpense '" + companyCode + "','" + dcrCode + "','" + userCode + "','" + dcrDate + "','" + flag + "'");
                        }
                    }
                    finally
                    {
                        _objData.CloseConnection();
                    }


                    if (dsDraftedExpense.Tables.Count > 0)
                    {
                        if (dsDraftedExpense.Tables[0].Rows.Count > 0)
                        {
                            DataTable dt = new DataTable();
                            dt = dsDraftedExpense.Tables[0];
                            lstDraftedExpense = (from item in dt.AsEnumerable()
                                                 select new Models.DCRExpenseModel()
                            {
                                ExpenseTypeCode = item["Expense_Type_Code"].ToString(),
                                ExpenseTypeName = item["Expense_Type_Name"].ToString(),
                                ExpenseRemark = item["Expense_Remarks"].ToString(),
                                ExpenseAmount = item["Expense_Amount"].ToString()
                            }).ToList <Models.DCRExpenseModel>();
                        }
                    }
                }

                if (dsExpenseAutoFill.Rows.Count > 0)
                {
                    DataTable dt = new DataTable();
                    dt             = dsExpenseAutoFill;
                    lstExpenseAuto = (from item in dt.AsEnumerable()
                                      select new Models.DCRExpenseModel()
                    {
                        ExpenseTypeCode = item["Expense_Type_Code"].ToString(),
                        ExpenseTypeName = item["Expense_Type_Name"].ToString(),
                        ExpenseMode = item["Expense_Mode"].ToString(),
                        ExpenseEntity = item["Expense_Entity"].ToString(),
                        ExpenseEntityCode = item["Expense_Entity_Code"].ToString(),
                        EligibilityAmount = item["Eligibility_Amount"].ToString(),
                        CanSplitAmount = item["Can_Split_Amount"].ToString(),
                        IsValidationOnEligibility = item["Is_Validation_On_Eligibility"].ToString(),
                        //IsPeriodBoundaryCheck = item["Is_Period_Boundary_Check"].ToString(),
                        SFC_Type = item["SFC_Type"].ToString(),
                        IsPrefill = item["Is_Prefill"].ToString(),
                        ExpenseGroupId = isExpenseGroup
                    }).ToList <Models.DCRExpenseModel>();
                }

                if (dsExpensePreFill.Rows.Count > 0)
                {
                    DataTable dt = new DataTable();
                    dt            = dsExpensePreFill;
                    lstExpensePre = (from item in dt.AsEnumerable()
                                     select new Models.DCRExpenseModel()
                    {
                        ExpenseTypeCode = item["Expense_Type_Code"].ToString(),
                        ExpenseTypeName = item["Expense_Type_Name"].ToString(),
                        ExpenseMode = item["Expense_Mode"].ToString(),
                        ExpenseEntity = item["Expense_Entity"].ToString(),
                        ExpenseEntityCode = item["Expense_Entity_Code"].ToString(),
                        EligibilityAmount = item["Eligibility_Amount"].ToString(),
                        CanSplitAmount = item["Can_Split_Amount"].ToString(),
                        IsValidationOnEligibility = item["Is_Validation_On_Eligibility"].ToString(),
                        //IsPeriodBoundaryCheck = item["Is_Period_Boundary_Check"].ToString(),
                        SFC_Type = item["SFC_Type"].ToString(),
                        IsPrefill = item["Is_Prefill"].ToString(),
                        TotalFare = Convert.ToDouble(item["Total_Fare"]),
                        ExpenseGroupId = isExpenseGroup
                    }).ToList <Models.DCRExpenseModel>();
                }

                List <JsonResult> lstExpense = new List <JsonResult> {
                    Json(lstExpenseAuto, JsonRequestBehavior.AllowGet), Json(lstExpensePre, JsonRequestBehavior.AllowGet), Json(lstDraftedExpense, JsonRequestBehavior.AllowGet)
                };

                return(Json(lstExpense, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }