示例#1
0
        private void Update_Promotion_From_View()
        {
            DataAccessPOS dbPOS = new DataAccessPOS();

            //if (String.IsNullOrEmpty(txt_ConfigName.Text)) txt_ConfigName.Text = "";
            //if (String.IsNullOrEmpty(txt_ConfigValue.Text)) txt_ConfigValue.Text = "";
            //if (String.IsNullOrEmpty(txt_ConfigDesc.Text)) txt_ConfigDesc.Text = "";
            int ipTypeId = 0;

            if (cb_PromoType.SelectedItem != null)
            {
                ppTypes = dbPOS.Get_PromoTypelkup_By_PromoTypeName(cb_PromoType.SelectedItem.ToString());
                if (ppTypes.Count == 1)
                {
                    ipTypeId = ppTypes[0].Id;
                }
            }
            ppromos.Clear();
            ppromos.Add(new POS_PromotionModel()
            {
                Id             = int.Parse(txt_PromoID.Text),
                PromoName      = txt_PromoName.Text,
                PromoType      = ipTypeId,
                PromoValue     = float.Parse(txt_PromoValue.Text),
                PromoQTY       = int.Parse(txt_PromoQTY.Text),
                PromoStartDttm = dttm_PromoStart.Value,
                PromoEndDttm   = dttm_PromoEnd.Value
            });
            int iCnt = dbPOS.Update_Promotion(ppromos[0]);

            txtMessage.Text      = "Promotion successfully Updated : " + txt_PromoName.Text;
            txtMessage.ForeColor = Color.White;
        }