public CRM_ConExecStatus_Info_Ety CRM_Authorize_KW_DSR(Hashtable ht)
        {
            CRM_ConExecStatus_Info_Ety ocrm_ConExecStatus_Info_ety = new CRM_ConExecStatus_Info_Ety();

            cn1.Open();
            string strProc = string.Empty;

            try
            {
                SqlParameter[] dsrparam = new SqlParameter[7];
                dsrparam[0]           = new SqlParameter("@Inempid", SqlDbType.SmallInt);
                dsrparam[1]           = new SqlParameter("@Indsrid", SqlDbType.VarChar);
                dsrparam[2]           = new SqlParameter("@InAuth", SqlDbType.VarChar);
                dsrparam[3]           = new SqlParameter("@InDsrAuth", SqlDbType.VarChar);
                dsrparam[4]           = new SqlParameter("@UsrId", SqlDbType.SmallInt);
                dsrparam[5]           = new SqlParameter("@Result", SqlDbType.VarChar, 200);
                dsrparam[5].Direction = ParameterDirection.InputOutput;
                dsrparam[6]           = new SqlParameter("@ExecStatus", SqlDbType.TinyInt);
                dsrparam[6].Direction = ParameterDirection.InputOutput;


                dsrparam[0].Value = Convert.ToInt32(ht["EmpId"]);
                dsrparam[1].Value = ht["DsrId"];
                dsrparam[2].Value = ht["DsrAuth"];
                dsrparam[3].Value = ht["DsrSlnoAuth"];
                dsrparam[4].Value = Convert.ToInt16(ht["UserId"]);
                dsrparam[5].Value = "";
                dsrparam[6].Value = 0;
                //int i = SqlHelper.ExecuteNonQuery(setCon(), CommandType.StoredProcedure, "dsr_multiplieAuthorization_Proc", dsrparam);

                strProc = "dsr_multiplieAuthorization_Proc";
                if (strProc != string.Empty)
                {
                    SqlHelper.ExecuteNonQuery(cn1, CommandType.StoredProcedure, strProc, dsrparam);
                }

                ocrm_ConExecStatus_Info_ety.ExecStatus = Convert.ToByte(dsrparam[6].Value.ToString());
                ocrm_ConExecStatus_Info_ety.Confirm    = dsrparam[6].Value.ToString();

                if (cn1 != null && cn1.State == ConnectionState.Open)
                {
                    cn1.Close();
                }
            }
            catch (Exception msg)
            {
                if (cn1 != null)
                {
                    cn1.Close();
                }
                ocrm_ConExecStatus_Info_ety.Confirm    = msg.Message.Replace("'", "");
                ocrm_ConExecStatus_Info_ety.ExecStatus = 0;
            }
            finally
            {
                if (cn1.State == ConnectionState.Open)
                {
                    cn1.Close();
                }
                if (cn1 != null)
                {
                    cn1.Dispose();
                }
            }
            return(ocrm_ConExecStatus_Info_ety);
        }
        public CRM_ConExecStatus_Info_Ety CRM_Save_KW_TravelExpenses(Hashtable ht, Hashtable dtParam)
        {
            CRM_ConExecStatus_Info_Ety ocrm_ConExecStatus_Info_ety = new CRM_ConExecStatus_Info_Ety();

            //SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            cn1.Open();
            SqlTransaction st      = cn1.BeginTransaction();
            string         strProc = string.Empty;

            try
            {
                SqlParameter[] dsrparam = new SqlParameter[18];
                dsrparam[0]            = new SqlParameter("@Intrvexpid", SqlDbType.BigInt);
                dsrparam[0].Direction  = ParameterDirection.InputOutput;
                dsrparam[1]            = new SqlParameter("@Inempid", SqlDbType.SmallInt);
                dsrparam[2]            = new SqlParameter("@Inarea", SqlDbType.SmallInt);
                dsrparam[3]            = new SqlParameter("@Intourfrmdate", SqlDbType.SmallDateTime);
                dsrparam[4]            = new SqlParameter("@Intourtodate", SqlDbType.SmallDateTime);
                dsrparam[5]            = new SqlParameter("@Intourauthorizedby", SqlDbType.SmallInt);
                dsrparam[6]            = new SqlParameter("@Inadvancedrawn", SqlDbType.Decimal);
                dsrparam[7]            = new SqlParameter("@Indeptime", SqlDbType.VarChar);
                dsrparam[8]            = new SqlParameter("@Inarivaltime", SqlDbType.VarChar);
                dsrparam[9]            = new SqlParameter("@Inrepdatetime", SqlDbType.SmallDateTime);
                dsrparam[10]           = new SqlParameter("@Inamtclaimed", SqlDbType.Decimal);
                dsrparam[11]           = new SqlParameter("@Inamtdisallowed", SqlDbType.Decimal);
                dsrparam[12]           = new SqlParameter("@Inamtpassed", SqlDbType.Decimal);
                dsrparam[13]           = new SqlParameter("@Inapprovedby", SqlDbType.SmallInt);
                dsrparam[14]           = new SqlParameter("@Inusrid", SqlDbType.SmallInt);
                dsrparam[15]           = new SqlParameter("@Inmode", SqlDbType.VarChar, 50);
                dsrparam[16]           = new SqlParameter("@execstatus", SqlDbType.SmallInt);
                dsrparam[16].Direction = ParameterDirection.Output;
                dsrparam[17]           = new SqlParameter("@result", SqlDbType.VarChar, 50);
                dsrparam[17].Direction = ParameterDirection.Output;

                dsrparam[0].Value  = ht["trvexpid"];
                dsrparam[1].Value  = Convert.ToInt16(ht["empid"]);
                dsrparam[2].Value  = Convert.ToInt16(ht["area"]);
                dsrparam[3].Value  = Convert.ToDateTime(ht["tourfrmdate"]);
                dsrparam[4].Value  = Convert.ToDateTime(ht["tourtodate"]);
                dsrparam[5].Value  = Convert.ToInt16(ht["tourauthorizedby"]);
                dsrparam[6].Value  = Convert.ToDecimal(ht["advancedrawn"]);
                dsrparam[7].Value  = ht["deptime"];
                dsrparam[8].Value  = ht["arivaltime"];
                dsrparam[9].Value  = Convert.ToDateTime(ht["repdatetime"]);
                dsrparam[10].Value = Convert.ToDecimal(ht["amtclaimed"]);
                dsrparam[11].Value = Convert.ToDecimal(ht["amtdisallowed"]);
                dsrparam[12].Value = Convert.ToDecimal(ht["amtpassed"]);
                dsrparam[13].Value = ht["approvedby"];
                dsrparam[14].Value = Convert.ToInt16(ht["UserId"]);
                dsrparam[15].Value = ht["Mode"];
                dsrparam[16].Value = 0;
                dsrparam[17].Value = "hh";

                strProc = "DSR_TravellingexpenseMast_proc";

                if (strProc != string.Empty)
                {
                    SqlHelper.ExecuteNonQuery(st, CommandType.StoredProcedure, strProc, dsrparam);
                }

                if (Convert.ToInt16(dsrparam[16].Value.ToString()) == 0)
                {
                    st.Rollback();
                    cn1.Close();
                    ocrm_ConExecStatus_Info_ety.Confirm    = dsrparam[17].Value.ToString();
                    ocrm_ConExecStatus_Info_ety.ExecStatus = Convert.ToByte(dsrparam[16].Value.ToString());
                    return(ocrm_ConExecStatus_Info_ety);
                }
                ocrm_ConExecStatus_Info_ety.ExecStatus = Convert.ToByte(dsrparam[16].Value.ToString());
                ocrm_ConExecStatus_Info_ety.Confirm    = dsrparam[17].Value.ToString();

                if (ht["Mode"].ToString() != "DELETE")
                {
                    SqlParameter[] dsrDtparam = new SqlParameter[17];
                    dsrDtparam[0] = new SqlParameter("@Intravellid", SqlDbType.BigInt);
                    dsrDtparam[1] = new SqlParameter("@Intrvdate", SqlDbType.VarChar);
                    dsrDtparam[2] = new SqlParameter("@Inparticulars", SqlDbType.VarChar);
                    dsrDtparam[3] = new SqlParameter("@Inmodeoftravell", SqlDbType.VarChar);
                    dsrDtparam[4] = new SqlParameter("@Infare", SqlDbType.VarChar);
                    dsrDtparam[5] = new SqlParameter("@Inlodging", SqlDbType.VarChar);
                    dsrDtparam[6] = new SqlParameter("@Inlocconvy", SqlDbType.VarChar);
                    dsrDtparam[6] = new SqlParameter("@InPOrderVal", SqlDbType.VarChar);

                    dsrDtparam[7]  = new SqlParameter("@InCollectAmt", SqlDbType.VarChar);
                    dsrDtparam[8]  = new SqlParameter("@InparticularsTo", SqlDbType.VarChar);
                    dsrDtparam[9]  = new SqlParameter("@Inmiscexp", SqlDbType.VarChar);
                    dsrDtparam[10] = new SqlParameter("@Inremarks", SqlDbType.VarChar);
                    dsrDtparam[11] = new SqlParameter("@Inusrid", SqlDbType.SmallInt);
                    dsrDtparam[12] = new SqlParameter("@Insupportingflag", SqlDbType.VarChar);
                    dsrDtparam[13] = new SqlParameter("@Inauthflag", SqlDbType.VarChar);

                    dsrDtparam[14]           = new SqlParameter("@Inmode", SqlDbType.VarChar, 50);
                    dsrDtparam[15]           = new SqlParameter("@execstatus", SqlDbType.SmallInt);
                    dsrDtparam[15].Direction = ParameterDirection.Output;
                    dsrDtparam[16]           = new SqlParameter("@result", SqlDbType.VarChar, 50);
                    dsrDtparam[16].Direction = ParameterDirection.Output;

                    dsrDtparam[0].Value = Convert.ToInt64(dsrparam[0].Value);
                    dsrDtparam[1].Value = dtParam["Trvdate"];
                    dsrDtparam[2].Value = dtParam["particulars"];
                    dsrDtparam[3].Value = dtParam["modeoftravell"]; // Convert.ToInt16(ht["tourfrmdate"]);
                    dsrDtparam[4].Value = dtParam["fare"];
                    dsrDtparam[5].Value = dtParam["lodging"];

                    dsrDtparam[6].Value  = dtParam["locconvy"];
                    dsrDtparam[7].Value  = dtParam["extconvy"];
                    dsrDtparam[8].Value  = dtParam["luggagechrg"];
                    dsrDtparam[6].Value  = dtParam["OrderVal"];
                    dsrDtparam[7].Value  = dtParam["ColAmt"];
                    dsrDtparam[8].Value  = dtParam["particularsTo"];
                    dsrDtparam[9].Value  = dtParam["miscexp"];
                    dsrDtparam[10].Value = dtParam["remarks"];
                    dsrDtparam[11].Value = Convert.ToInt16(ht["UserId"]);
                    dsrDtparam[12].Value = dtParam["supportingflag"];
                    dsrDtparam[13].Value = dtParam["AuthFlg"];
                    dsrDtparam[14].Value = dtParam["Mode"];
                    dsrDtparam[15].Value = 0;
                    dsrDtparam[16].Value = "hh";

                    strProc = "DSR_Travellingexpdetails_proc";

                    if (strProc != string.Empty)
                    {
                        SqlHelper.ExecuteNonQuery(st, CommandType.StoredProcedure, strProc, dsrDtparam);
                    }
                    if (Convert.ToInt16(dsrDtparam[15].Value.ToString()) == 0)
                    {
                        st.Rollback();
                        cn1.Close();
                        ocrm_ConExecStatus_Info_ety.Confirm    = dsrDtparam[16].Value.ToString();
                        ocrm_ConExecStatus_Info_ety.ExecStatus = Convert.ToByte(dsrDtparam[15].Value.ToString());
                        return(ocrm_ConExecStatus_Info_ety);
                    }
                    ocrm_ConExecStatus_Info_ety.ExecStatus = Convert.ToByte(dsrDtparam[15].Value.ToString());
                    ocrm_ConExecStatus_Info_ety.Confirm    = dsrDtparam[16].Value.ToString();
                }
                st.Commit();
                if (cn1 != null && cn1.State == ConnectionState.Open)
                {
                    cn1.Close();
                }
            }
            catch (Exception msg)
            {
                st.Rollback();
                if (cn1 != null)
                {
                    cn1.Close();
                }
                if (res == null)
                {
                    res = msg.Message;
                }
                ocrm_ConExecStatus_Info_ety.Confirm    = msg.Message;
                ocrm_ConExecStatus_Info_ety.ExecStatus = 0;
            }
            finally
            {
                if (cn1.State == ConnectionState.Open)
                {
                    cn1.Close();
                }
                if (cn1 != null)
                {
                    cn1.Dispose();
                }
            }

            return(ocrm_ConExecStatus_Info_ety);
        }
        public CRM_ConExecStatus_Info_Ety CRM_Save_KW_DSR_Details(Hashtable ht, string ProcType)
        {
            CRM_ConExecStatus_Info_Ety ocrm_ConExecStatus_Info_ety = new CRM_ConExecStatus_Info_Ety();

            cn1.Open();
            string strProc = string.Empty;

            try
            {
                SqlParameter[] dsrparam = new SqlParameter[14];
                dsrparam[0]            = new SqlParameter("@Indsrid", SqlDbType.BigInt);
                dsrparam[1]            = new SqlParameter("@Indsrdate", SqlDbType.SmallDateTime);
                dsrparam[2]            = new SqlParameter("@Inempid", SqlDbType.SmallInt);
                dsrparam[3]            = new SqlParameter("@Indsroption", SqlDbType.SmallInt);
                dsrparam[4]            = new SqlParameter("@Inareasvisited", SqlDbType.VarChar, 4000);
                dsrparam[5]            = new SqlParameter("@Inpoamount", SqlDbType.Decimal);
                dsrparam[6]            = new SqlParameter("@Inchequeamount", SqlDbType.Decimal);
                dsrparam[7]            = new SqlParameter("@Incashcollected", SqlDbType.Decimal);
                dsrparam[8]            = new SqlParameter("@Inremarks", SqlDbType.VarChar, 4000);
                dsrparam[9]            = new SqlParameter("@InAccId", SqlDbType.BigInt);
                dsrparam[10]           = new SqlParameter("@Inusrid", SqlDbType.SmallInt);
                dsrparam[11]           = new SqlParameter("@Inmode", SqlDbType.VarChar, 50);
                dsrparam[12]           = new SqlParameter("@execstatus", SqlDbType.SmallInt);
                dsrparam[13]           = new SqlParameter("@result", SqlDbType.VarChar, 500);
                dsrparam[12].Direction = ParameterDirection.Output;
                dsrparam[13].Direction = ParameterDirection.Output;

                dsrparam[0].Value  = Convert.ToInt64(ht["DsrId"]);
                dsrparam[1].Value  = Convert.ToDateTime(ht["DsrDare"]);
                dsrparam[2].Value  = Convert.ToInt16(ht["EmpId"]);
                dsrparam[3].Value  = Convert.ToInt16(ht["DsrMode"]);
                dsrparam[4].Value  = ht["DsrArea"];
                dsrparam[5].Value  = Convert.ToDecimal(ht["PoAmt"]);
                dsrparam[6].Value  = Convert.ToDecimal(ht["ChqAmt"]);
                dsrparam[7].Value  = Convert.ToDecimal(ht["CashAmt"]);
                dsrparam[8].Value  = ht["Remarks"];
                dsrparam[9].Value  = Convert.ToInt64(ht["AccId"]);
                dsrparam[10].Value = Convert.ToInt16(ht["UserId"]);
                dsrparam[11].Value = ht["Mode"];
                dsrparam[12].Value = 0;
                dsrparam[13].Value = "hh";

                strProc = "DSR_dailySalesRpt_proc";

                if (ProcType == "Mast")
                {
                    strProc = "DSR_dailySalesRpt_proc";
                }
                else if (ProcType == "MastAuth")
                {
                    strProc = "DSR_dailySalesRptMastAuth_proc";
                }
                else if (ProcType == "Auth")
                {
                    strProc = "DSR_dailySalesRptAuth_proc";
                }

                if (strProc != string.Empty)
                {
                    SqlHelper.ExecuteNonQuery(cn1, CommandType.StoredProcedure, strProc, dsrparam);
                }

                ocrm_ConExecStatus_Info_ety.ExecStatus = Convert.ToByte(dsrparam[12].Value.ToString());
                ocrm_ConExecStatus_Info_ety.Confirm    = dsrparam[13].Value.ToString();

                if (cn1 != null && cn1.State == ConnectionState.Open)
                {
                    cn1.Close();
                }
            }
            catch (Exception msg)
            {
                if (cn1 != null)
                {
                    cn1.Close();
                }
                ocrm_ConExecStatus_Info_ety.Confirm    = msg.Message.Replace("'", "");
                ocrm_ConExecStatus_Info_ety.ExecStatus = 0;
            }
            finally
            {
                if (cn1.State == ConnectionState.Open)
                {
                    cn1.Close();
                }
                if (cn1 != null)
                {
                    cn1.Dispose();
                }
            }

            return(ocrm_ConExecStatus_Info_ety);
        }