示例#1
0
        public string InsertProduct(FormCollection collection)
        {
            string effFrom        = collection["EffectiveFrom"].ToString();
            string effTo          = collection["EffectiveTo"].ToString();
            string competitorName = "";

            if (collection["ProductTypeName"].ToString().ToUpper() == "COMPETITOR")
            {
                competitorName = collection["competitor"].ToString();
            }
            else
            {
                competitorName = "NULL";
            }

            if (!string.IsNullOrEmpty(effFrom))
            {
                effFrom = effFrom.Split('/')[2] + "-" + effFrom.Split('/')[1] + "-" + effFrom.Split('/')[0];
                // effFrom = Convert.ToDateTime(collection["EffectiveFrom"].ToString()).ToString("yyyy-MM-dd");
            }
            if (!string.IsNullOrEmpty(effTo))
            {
                effTo = effTo.Split('/')[2] + "-" + effTo.Split('/')[1] + "-" + effTo.Split('/')[0];
                // effTo = Convert.ToDateTime(collection["EffectiveTo"].ToString()).ToString("yyyy-MM-dd");
            }

            string result = objData.InsertProduct("sp_sdInsertProduct", objCurInfo.GetCompanyCode(), collection["ProductName"].ToString(), collection["SpecialityCode"].ToString(),
                                                  collection["BrandCode"].ToString(), collection["CategoryCode"].ToString(), collection["UOMTypeCode"].ToString(), collection["UOMCode"].ToString(), collection["ProductTypeCode"].ToString(),
                                                  collection["ProductGroupCode"].ToString(), collection["ProductDesc"].ToString(), collection["ProductTypeName"].ToString(), collection["ProductShortName"].ToString(),
                                                  collection["ProductCost"].ToString(), effFrom, effTo, collection["ProductCode"].ToString(), competitorName, collection["RefKey1"].ToString(), collection["RefKey2"].ToString(), objCurInfo.GetUserCode());

            return(result.Trim().Length == 0 ? "SUCCESS" : result);
        }