public ActionResult Save_Terms(string isDelete, string isActive, string TermsID, string Name,
                                       string DueInFixedNumberDays, string DueInCertainDayOfMonth, string DueInNextMonth, string Discount)
        {
            string OrganizationCode = "";

            if (Session["UserDetails"] != null && ((UserInfo)Session["UserDetails"]).UserType.ToString().Trim().ToUpper() == "R" && ((UserInfo)Session["UserDetails"]).OrganizationCode != null)
            {
                OrganizationCode = ((UserInfo)Session["UserDetails"]).OrganizationCode.Trim();
            }

            using (Master_Svc.MasterServiceClient iGstSvc = new Master_Svc.MasterServiceClient())
            {
                TermsInfo objTermsInfo = new TermsInfo();

                objTermsInfo.Id               = TermsID;
                objTermsInfo.Name             = Name;
                objTermsInfo.IsActive         = isActive == "Y";
                objTermsInfo.OrganizationCode = OrganizationCode;

                objTermsInfo.DueInFixedNumberDays = DueInFixedNumberDays;
                objTermsInfo.DueInFixedNumberDays = DueInFixedNumberDays;
                objTermsInfo.DueInNextMonth       = DueInNextMonth;
                objTermsInfo.Discount             = Discount;

                if (iGstSvc.Save_Terms(isDelete == "Y", objTermsInfo, (UserInfo)Session["UserDetails"], out ErrorMessage))
                {
                    return(Json("Ok", JsonRequestBehavior.AllowGet));
                }
            }

            return(Json(ErrorMessage, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public static List <TermsInfo> GetList_Terms(string TermsID, string OrganisationCode)
        {
            List <TermsInfo> list = new List <TermsInfo>();

            using (DBHelper dbhlper = new DBHelper("spMSTTermsGet"))
            {
                DBHelper.AddPparameter("@ID", string.IsNullOrEmpty(TermsID) ? "0" : TermsID);
                DBHelper.AddPparameter("@OrganizationCode", string.IsNullOrEmpty(OrganisationCode) ? "" : OrganisationCode);

                using (DataSet ds = DBHelper.Execute_Query())
                {
                    if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        TermsInfo obj = null;

                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            obj                = new TermsInfo();
                            obj.Id             = dr["ID"].ToString();
                            obj.DatauniqueID   = dr["DatauniqueID"].ToString();
                            obj.Name           = dr["Name"].ToString();
                            obj.LastModifiedBy = dr["LastModifiedBy"].ToString();
                            obj.LastModifiedOn = Convert.ToDateTime(dr["LastModifiedOn"]);

                            list.Add(obj);
                        }
                    }
                }
            }

            return(list);
        }
Exemple #3
0
        public static bool Save_Terms(bool isOnlyDelete, TermsInfo TermsInfo, UserInfo objUserInfo, out string errormsg)
        {
            errormsg = "";
            flag     = false;

            #region Validations
            if (!Validations.ValidateDataType(TermsInfo.OrganizationCode, Validations.ValueType.AlphaNumericSpecialChar, false, "Organization", out errormsg))
            {
                return(false);
            }
            if (!Validations.ValidateDataType(TermsInfo.Id, Validations.ValueType.Integer, true, "Id", out errormsg))
            {
                return(false);
            }
            if (!Validations.ValidateDataType(TermsInfo.Name, Validations.ValueType.AlphaNumericSpecialChar, true, "Title", out errormsg))
            {
                return(false);
            }
            if (!Validations.ValidateDataType(TermsInfo.DueInCertainDayOfMonth.ToString(), Validations.ValueType.Integer, true, "Due in certain day of month", out errormsg))
            {
                return(false);
            }
            if (!Validations.ValidateDataType(TermsInfo.DueInFixedNumberDays.ToString(), Validations.ValueType.Integer, true, "Due in fixed number days", out errormsg))
            {
                return(false);
            }
            if (!Validations.ValidateDataType(TermsInfo.DueInNextMonth.ToString(), Validations.ValueType.Integer, true, "Due in next month", out errormsg))
            {
                return(false);
            }
            if (!Validations.ValidateDataType(TermsInfo.Discount.ToString(), Validations.ValueType.Numeric, true, "Discount", out errormsg))
            {
                return(false);
            }
            #endregion

            using (DBHelper dbhlper = new DBHelper("[spMSTTermsSave]", true))
            {
                DBHelper.AddPparameter("@Id", (TermsInfo.Id == "" ? "0" : TermsInfo.Id), DBHelper.param_types.BigInt);
                DBHelper.AddPparameter("@Name", HttpUtility.HtmlEncode(TermsInfo.Name), DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@OrganizationCode", HttpUtility.HtmlEncode(TermsInfo.OrganizationCode), DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@DueInFixedNumberDays", HttpUtility.HtmlEncode(TermsInfo.DueInFixedNumberDays), DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@DueInCertainDayOfMonth", HttpUtility.HtmlEncode(TermsInfo.DueInCertainDayOfMonth), DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@DueInNextMonth", HttpUtility.HtmlEncode(TermsInfo.DueInNextMonth), DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@Discount", HttpUtility.HtmlEncode(TermsInfo.Discount), DBHelper.param_types.Varchar);

                DBHelper.AddPparameter("@IsActive", TermsInfo.IsActive, DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@UserCode", objUserInfo.UserCode.ToString().Trim(), DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@isOnlyDelete", (isOnlyDelete ? 'Y' : 'N'), DBHelper.param_types.Varchar);
                DBHelper.AddPparameter("@NewDatauniqueID", NewDatauniqueID, DBHelper.param_types.BigInt, 50, DBHelper.param_direction.Output);
                DBHelper.AddPparameter("@ErrorMessage", errormsg, DBHelper.param_types.Varchar, 500, DBHelper.param_direction.Output);

                return(DBHelper.Execute_NonQuery(out errormsg));
            }
        }
Exemple #4
0
 public bool Save_Terms(bool isOnlyDelete, TermsInfo TermsInfo, UserInfo objUserInfo, out string errormsg)
 {
     return(wscalls.Save_Terms(isOnlyDelete, TermsInfo, objUserInfo, out errormsg));
 }