public ActionResult SaveDrs(FNM_CURR_RATE_VM FNMcurR)
        {
            List <SessionListnew> list = Session["SesDet"] as List <SessionListnew>;

            if (list == null)
            {
                return(Redirect("Login/InLogin"));
            }
            else
            {
                FNMcurR.CMPYCODE = list[0].CmpyCode;
                FNMcurR.UserName = list[0].user_name;
                return(Json(_FNM_CURR_RATEService.SaveFNM_CURR_RATE(FNMcurR), JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 2
0
        public FNM_CURR_RATE_VM EditFNM_CURR_RATE(string CmpyCode, string FROM_CURRENCY_CODE, DateTime ENTRY_DATE, string Tocurrdate)
        {
            dte1   = Convert.ToDateTime(ENTRY_DATE);
            dtstr2 = dte1.ToString("yyyy-MM-dd");
            ds     = _EzBusinessHelper.ExecuteDataSet("Select * from FNM_CURR_RATE where CMPYCODE='" + CmpyCode + "' and FROM_CURRENCY_CODE='" + FROM_CURRENCY_CODE + "' and TO_CURRENCY_CODE='" + Tocurrdate + "' and format(ENTRY_DATE,'yyyy-MM-dd')='" + dtstr2 + "' and Flag=0");//
            dt     = ds.Tables[0];
            DataRowCollection drc     = dt.Rows;
            FNM_CURR_RATE_VM  ObjList = new FNM_CURR_RATE_VM();

            foreach (DataRow dr in drc)
            {
                ObjList.FROM_CURRENCY_CODE = dr["FROM_CURRENCY_CODE"].ToString();
                ObjList.TO_CURRENCY_CODE   = dr["TO_CURRENCY_CODE"].ToString();
                ObjList.MASTER_STATUS      = dr["MASTER_STATUS"].ToString();
                ObjList.Note        = dr["Note"].ToString();
                ObjList.ENTRY_DATE  = Convert.ToDateTime(dr["ENTRY_DATE"].ToString());
                ObjList.BUY_RATE    = Convert.ToDecimal(dr["BUY_RATE"].ToString());
                ObjList.SELL_RATE   = Convert.ToDecimal(dr["SELL_RATE"].ToString());
                ObjList.Branch_code = Convert.ToString(dr["Branchcode"].ToString());
            }
            return(ObjList);
        }
Esempio n. 3
0
        public FNM_CURR_RATE_VM SaveFNM_CURR_RATE(FNM_CURR_RATE_VM FnCurRate)
        {
            try
            {
                dte    = Convert.ToDateTime(DateTime.Now.ToString());
                dtstr1 = dte.ToString("yyyy-MM-dd hh:mm:ss tt");

                dte1   = Convert.ToDateTime(FnCurRate.ENTRY_DATE);
                dtstr2 = dte1.ToString("yyyy-MM-dd");

                if (!FnCurRate.EditFlag)
                {
                    int Stats1 = _EzBusinessHelper.ExecuteScalar("Select count(*) as [count1] from FNM_CURR_RATE where CMPYCODE='" + FnCurRate.CMPYCODE + "' and FROM_CURRENCY_CODE='" + FnCurRate.FROM_CURRENCY_CODE + "' and format(ENTRY_DATE,'yyyy-MM-dd hh:mm:ss tt')='" + dtstr2 + "' and Flag=0");
                    if (Stats1 == 0)
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append("'" + FnCurRate.CMPYCODE + "',");
                        sb.Append("'" + FnCurRate.TO_CURRENCY_CODE + "',");
                        sb.Append("'" + FnCurRate.FROM_CURRENCY_CODE + "',");
                        sb.Append("'" + FnCurRate.SELL_RATE + "',");
                        sb.Append("'" + FnCurRate.BUY_RATE + "',");
                        sb.Append("'" + FnCurRate.UserName + "',");
                        sb.Append("'" + dtstr1 + "',");
                        sb.Append("'" + FnCurRate.UserName + "',");
                        sb.Append("'" + dtstr1 + "',");
                        sb.Append("'" + dtstr2 + "',");
                        sb.Append("'" + FnCurRate.MASTER_STATUS + "',");
                        sb.Append("'" + FnCurRate.Branch_code + "'");
                        sb.Append("'" + FnCurRate.Note + "')");
                        int i = _EzBusinessHelper.ExecuteNonQuery("insert into FNM_CURR_RATE(CMPYCODE,TO_CURRENCY_CODE,FROM_CURRENCY_CODE,SELL_RATE,BUY_RATE,CREATED_BY,CREATED_ON,UPDATED_BY,UPDATED_ON,ENTRY_DATE,MASTER_STATUS,Branchcode,NOTE) values(" + sb.ToString() + "");
                        _EzBusinessHelper.ActivityLog(FnCurRate.CMPYCODE, FnCurRate.UserName, "Add FNM_CURR_RATE", FnCurRate.FROM_CURRENCY_CODE, Environment.MachineName);
                        FnCurRate.SaveFlag     = true;
                        FnCurRate.ErrorMessage = string.Empty;
                    }
                    else
                    {
                        FnCurRate.SaveFlag     = false;
                        FnCurRate.ErrorMessage = "Duplicate Record";
                    }
                    return(FnCurRate);
                }
                var StatsEdit = _EzBusinessHelper.ExecuteScalarDec("Select count(*) from FNM_CURR_RATE where CMPYCODE='" + FnCurRate.CMPYCODE + "' and FROM_CURRENCY_CODE='" + FnCurRate.FROM_CURRENCY_CODE + "' and format(ENTRY_DATE,'yyyy-MM-dd')='" + dtstr2 + "' and Flag=0");
                if (StatsEdit != 0)
                {
                    StringBuilder sb = new StringBuilder();

                    sb.Append("BUY_RATE='" + FnCurRate.BUY_RATE + "',");
                    sb.Append("ENTRY_DATE='" + dtstr2 + "',");
                    sb.Append("MASTER_STATUS='" + FnCurRate.MASTER_STATUS + "',");
                    sb.Append("Note='" + FnCurRate.Note + "',");
                    sb.Append("TO_CURRENCY_CODE='" + FnCurRate.TO_CURRENCY_CODE + "',");
                    sb.Append("Branchcode='" + FnCurRate.Branch_code + "',");
                    sb.Append("SELL_RATE='" + FnCurRate.SELL_RATE + "',");
                    sb.Append("UPDATED_BY='" + FnCurRate.UserName + "',");
                    sb.Append("UPDATED_ON='" + dtstr1 + "'");

                    _EzBusinessHelper.ExecuteNonQuery("update FNM_CURR_RATE set  " + sb + " where CMPYCODE='" + FnCurRate.CMPYCODE + "' and FROM_CURRENCY_CODE='" + FnCurRate.FROM_CURRENCY_CODE + "' and format(ENTRY_DATE,'yyyy-MM-dd')='" + dtstr2 + "' and Flag=0");
                    _EzBusinessHelper.ActivityLog(FnCurRate.CMPYCODE, FnCurRate.UserName, "Update FNM_CURR_RATE", FnCurRate.FROM_CURRENCY_CODE, Environment.MachineName);

                    FnCurRate.SaveFlag     = true;
                    FnCurRate.ErrorMessage = string.Empty;
                }
                else
                {
                    FnCurRate.SaveFlag     = false;
                    FnCurRate.ErrorMessage = "Record not available";
                }
            }
            catch (Exception ex)
            {
                FnCurRate.SaveFlag = false;
            }

            return(FnCurRate);
        }
 public FNM_CURR_RATE_VM SaveFNM_CURR_RATE(FNM_CURR_RATE_VM ac)
 {
     return(_FNM_CURR_RATERep.SaveFNM_CURR_RATE(ac));
 }