예제 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            SaMIOrganizations objSaMIOrganizations = new SaMIOrganizations();
            objSaMIOrganizations.DistrictID = Convert.ToInt32(ddlDistrict.SelectedValue);
            objSaMIOrganizations.SaMIOrganizationName = txtOrganizationName.Text;
            objSaMIOrganizations.Status = 1;

            if (!string.IsNullOrEmpty(hfSaMIOrganizationID.Value.ToString()))
            {
                objSaMIOrganizations.UpdatedBy = UserAuthentication.GetUserId(this.Page);
                objSaMIOrganizations.UpdatedDate = DateTime.Now;
                objSaMIOrganizations.SaMIOrganizationID = Convert.ToInt32(hfSaMIOrganizationID.Value);
                SaMIOrganizationBO.UpdateSaMIOrganization(objSaMIOrganizations);
            }
            else
            {
                objSaMIOrganizations.CreatedBy = UserAuthentication.GetUserId(this.Page);
                objSaMIOrganizations.CreatedDate = DateTime.Now;
                SaMIOrganizationBO.InsertSaMIOrganization(objSaMIOrganizations);
            }

            ddlDistrict.SelectedIndex = 0;
            txtOrganizationName.Text = string.Empty;
            hfSaMIOrganizationID.Value = string.Empty;
            LoadSaMIOrganizations();
        }
        public int DeleteSaMIOrganization(SaMIOrganizations objSaMIOrganizations)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "Status" };
                rowsaffected = Update(objSaMIOrganizations, UpdateProperties);
                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;

        }
        public int InsertSaMIOrganization(SaMIOrganizations objSaMIOrganizations)
        {
            objSaMIOrganizations.SaMIOrganizationID = 1;
            BeginTransaction();

            try
            {
                objSaMIOrganizations.SaMIOrganizationID = Insert(objSaMIOrganizations);
                CommitTransaction();
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                objSaMIOrganizations.SaMIOrganizationID = -1;
            }

            return objSaMIOrganizations.SaMIOrganizationID;
        }
        // POST api/samiorganizations
        public SaMIOrganizations Post(SaMIOrganizations objOrganization)
        {
            if (objOrganization.GUID > 0)
            {
                objOrganization.SaMIOrganizationID = objOrganization.GUID;
                int rowResult = SaMIOrganizationBO.UpdateSaMIOrganization(objOrganization);

                //Return Back to The Client               
                return objOrganization;
            }
            else
            {               
                
                int rowResult = SaMIOrganizationBO.InsertSaMIOrganization(objOrganization);

                //Return Back to The Client               
                return objOrganization;
            }
        }
        public int UpdateSaMIOrganization(SaMIOrganizations objSaMIOrganizations)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "SaMIOrganizationName", "DistrictID", "UpdatedBy", "UpdatedDate",
                                                            "Status", "SyncStatus"};
                rowsaffected = Update(objSaMIOrganizations, UpdateProperties);
                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;

        }
예제 #6
0
        protected void gvOrgnaizations_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            hfSaMIOrganizationID.Value = e.CommandArgument.ToString();
            SaMIOrganizations objSaMIOrganizations = new SaMIOrganizations();

            if (e.CommandName.Equals("cmdEdit"))
            {
                objSaMIOrganizations = SaMIOrganizationBO.GetSaMIOrganization(Convert.ToInt32(e.CommandArgument));
                ddlDistrict.SelectedValue = objSaMIOrganizations.DistrictID.ToString();
                txtOrganizationName.Text = objSaMIOrganizations.SaMIOrganizationName;
            }
            else if (e.CommandName.Equals("cmdDelete"))
            {
                int SaMIOrganizationID = Convert.ToInt32(e.CommandArgument);
                objSaMIOrganizations.SaMIOrganizationID = SaMIOrganizationID;
                objSaMIOrganizations.Status = 0;
                SaMIOrganizationBO.DeleteSaMIOrganization(objSaMIOrganizations);
                LoadSaMIOrganizations();
            }
        }
예제 #7
0
 public static int DeleteSaMIOrganization(SaMIOrganizations objSaMIOrganizations)
 {
     return new SaMIOrganizationDAO().DeleteSaMIOrganization(objSaMIOrganizations);
 }
예제 #8
0
 public static int UpdateSaMIOrganization(SaMIOrganizations objSaMIOrganizations)
 {
     return new SaMIOrganizationDAO().UpdateSaMIOrganization(objSaMIOrganizations);
 }
예제 #9
0
 public static SaMIOrganizations GetSaMIOrganization(int caseTypeID)
 {
     SaMIOrganizations objSaMIOrganizations = new SaMIOrganizations();
     return (SaMIOrganizations)(new SaMIOrganizationDAO().FillDTO(objSaMIOrganizations, "SaMIOrganizationID=" + caseTypeID));
 }
예제 #10
0
 public static int InsertSaMIOrganization(SaMIOrganizations objSaMIOrganizations)
 {
     return new SaMIOrganizationDAO().InsertSaMIOrganization(objSaMIOrganizations);
 }