Example #1
0
        public bool DBMaster_DM_GoiY_Save(DM_GoiY dm_goiy)
        {
            int goiYID = 0;

            try
            {
                bool flagupd = true; //1: insert - 0: update
                cons = new SqlConnection(DBMasterConn);
                cons.Open();
                trans = cons.BeginTransaction();

                if (dm_goiy.GoiYID != 0)
                {
                    flagupd = false;
                    goiYID  = dm_goiy.GoiYID;
                }
                else
                {
                    flagupd = true;
                }
                if (flagupd)
                {
                    var insDM_GoiY = _dM_GoiYRepository.DBMaster_DM_GoiY_Ins(dm_goiy, cons, trans);
                    if (!insDM_GoiY)
                    {
                        XmlConfigurator.Configure();
                        log.Error("result = DBMaster_DM_GoiY_Ins(EdXml);");
                        trans.Rollback();
                        return(false);
                    }
                }
                else
                {
                    var updDM_GoiY = _dM_GoiYRepository.DBMaster_DM_GoiY_UpdByGoiYID(dm_goiy, cons, trans);
                    if (!updDM_GoiY)
                    {
                        XmlConfigurator.Configure();
                        log.Error("result = DBMaster_DM_GoiY_UpdByGoiYID(EdXml);");
                        trans.Rollback();
                        return(false);
                    }
                }
                trans.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                XmlConfigurator.Configure();
                log.Error(ex.Message, ex);
                trans.Rollback();
                return(false);
            }
        }
Example #2
0
        public IRestResponse DBMaster_DM_GoiY_Save(DM_GoiY dm_goiy)
        {
            var request = new RestRequest("MT/DBMaster_DM_GoiY_Save", Method.POST)
            {
                RequestFormat  = DataFormat.Json,
                JsonSerializer = new JsonSerializer()
            };
            var settings = new JsonSerializerSettings {
                DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
            };
            var json = JsonConvert.SerializeObject(dm_goiy, settings);

            request.AddParameter("application/json", json, null, ParameterType.RequestBody);
            return(Execute(request));
        }