public ActionResult Insert_T12332(t12073 t12073)
        {
            var    user       = Session["T_EMP_CODE"].ToString();
            var    data       = repository.Insert_T12332(t12073, user);
            string JSONString = string.Empty;

            JSONString = JsonConvert.SerializeObject(data);
            return(Json(JSONString, JsonRequestBehavior.AllowGet));
        }
        public string Insert_T12332(t12073 t12073, string user)
        {
            //var Data = obj.Insert_T12332(t12073, user);
            //return Data;

            var data = "";

            try
            {
                data = obj.Insert_T12332(t12073, user);
            }
            catch (Exception e)
            {
                MethodBase m = MethodBase.GetCurrentMethod();
                obj.Log(m.ReflectedType.Name + "." + m.Name, "1", e.Message);
            }

            return(data);
        }
示例#3
0
        public string Insert_T12332(t12073 t12073, string user)
        {
            string msg = "";

            int count       = Query($"SELECT T_UNIT_TYPE FROM T12073 WHERE T_UNIT_TYPE  = '{t12073.T_UNIT_TYPE}'").Rows.Count;
            var max         = Query($"select lpad((MAX(T_UNIT_TYPE)+1),2,'0') T_UNIT_TYPE FROM T12073");
            var maxUnittype = max.Rows[0]["T_UNIT_TYPE"];

            BeginTransaction();

            if (count == 0)
            {
                if (Command($"INSERT INTO T12073 (T_ENTRY_USER,T_ENTRY_DATE,T_UNIT_TYPE,T_LANG2_NAME,T_LANG1_NAME, T_NO_OF_BAG ) VALUES ('{user}', TRUNC(SYSDATE), '{maxUnittype}', '{t12073.T_LANG2_NAME}', '{t12073.T_LANG1_NAME}', '{t12073.T_NO_OF_BAG}')"))
                {
                    CommitTransaction();
                    msg = "N0040";
                }
                else
                {
                    RollbackTransaction();
                    msg = "N0071";
                }
            }
            else
            {
                if (Command(
                        $"UPDATE T12073 SET T_UPD_USER='******',T_UPD_DATE=TRUNC(SYSDATE),T_LANG2_NAME='{t12073.T_LANG2_NAME}',T_LANG1_NAME='{t12073.T_LANG1_NAME}',T_NO_OF_BAG='{t12073.T_NO_OF_BAG}' WHERE T_UNIT_TYPE='{t12073.T_UNIT_TYPE}' "))
                {
                    CommitTransaction();
                    msg = "N0041";
                }
                else
                {
                    RollbackTransaction();
                    msg = "N0072";
                }
            }
            return(msg);
        }