Exemplo n.º 1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            JavaScript.RequestRegistration(CommonJs.jQuery);
        }
Exemplo n.º 2
0
 /// <summary>
 ///     构造
 /// </summary>
 protected BaseMasterPage()
 {
     WebTitle   = WebConfigs.ConfigEntity.WebTitle;
     JavaScript = new JavaScript(Page);
     LhgDialog  = new LhgDialog(Page);
 }
Exemplo n.º 3
0
        public static void EnableMinMax(Control objButton, Control objContent, int intModuleId, bool blnDefaultMin, string strMinIconLoc, string strMaxIconLoc, MinMaxPersistanceType ePersistanceType,
                                        int intAnimationFrames, string strPersonalizationNamingCtr, string strPersonalizationKey)
        {
            if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
            {
                JavaScript.RegisterClientReference(objButton.Page, ClientAPI.ClientNamespaceReferences.dnn_dom);
                switch (ePersistanceType)
                {
                case MinMaxPersistanceType.None:
                    AddAttribute(objButton, "onclick", "if (__dnn_SectionMaxMin(this,  '" + objContent.ClientID + "')) return false;");
                    if (!string.IsNullOrEmpty(strMinIconLoc))
                    {
                        AddAttribute(objButton, "max_icon", strMaxIconLoc);
                        AddAttribute(objButton, "min_icon", strMinIconLoc);
                    }

                    break;

                case MinMaxPersistanceType.Page:
                    AddAttribute(objButton, "onclick", "if (__dnn_SectionMaxMin(this,  '" + objContent.ClientID + "')) return false;");
                    if (!string.IsNullOrEmpty(strMinIconLoc))
                    {
                        AddAttribute(objButton, "max_icon", strMaxIconLoc);
                        AddAttribute(objButton, "min_icon", strMinIconLoc);
                    }

                    break;

                case MinMaxPersistanceType.Cookie:
                    if (intModuleId != -1)
                    {
                        AddAttribute(objButton, "onclick", "if (__dnn_ContainerMaxMin_OnClick(this, '" + objContent.ClientID + "')) return false;");
                        ClientAPI.RegisterClientVariable(objButton.Page, "containerid_" + objContent.ClientID, intModuleId.ToString(), true);
                        ClientAPI.RegisterClientVariable(objButton.Page, "cookieid_" + objContent.ClientID, "_Module" + intModuleId + "_Visible", true);

                        ClientAPI.RegisterClientVariable(objButton.Page, "min_icon_" + intModuleId, strMinIconLoc, true);
                        ClientAPI.RegisterClientVariable(objButton.Page, "max_icon_" + intModuleId, strMaxIconLoc, true);

                        ClientAPI.RegisterClientVariable(objButton.Page, "max_text", Localization.GetString("Maximize"), true);
                        ClientAPI.RegisterClientVariable(objButton.Page, "min_text", Localization.GetString("Minimize"), true);

                        if (blnDefaultMin)
                        {
                            ClientAPI.RegisterClientVariable(objButton.Page, "__dnn_" + intModuleId + ":defminimized", "true", true);
                        }
                    }

                    break;

                case MinMaxPersistanceType.Personalization:
                    // Regardless if we determine whether or not the browser supports client-side personalization
                    // we need to store these keys to properly display or hide the content (They are needed in MinMaxContentVisible)
                    AddAttribute(objButton, "userctr", strPersonalizationNamingCtr);
                    AddAttribute(objButton, "userkey", strPersonalizationKey);
                    if (EnableClientPersonalization(strPersonalizationNamingCtr, strPersonalizationKey, objButton.Page))
                    {
                        AddAttribute(objButton, "onclick", "if (__dnn_SectionMaxMin(this,  '" + objContent.ClientID + "')) return false;");
                        if (!string.IsNullOrEmpty(strMinIconLoc))
                        {
                            AddAttribute(objButton, "max_icon", strMaxIconLoc);
                            AddAttribute(objButton, "min_icon", strMinIconLoc);
                        }
                    }

                    break;
                }
            }

            if (MinMaxContentVisibile(objButton, intModuleId, blnDefaultMin, ePersistanceType))
            {
                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
                {
                    AddStyleAttribute(objContent, "display", string.Empty);
                }
                else
                {
                    objContent.Visible = true;
                }

                if (!string.IsNullOrEmpty(strMinIconLoc))
                {
                    SetMinMaxProperties(objButton, strMinIconLoc, Localization.GetString("Minimize"), Localization.GetString("Minimize"));
                }
            }
            else
            {
                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
                {
                    AddStyleAttribute(objContent, "display", "none");
                }
                else
                {
                    objContent.Visible = false;
                }

                if (!string.IsNullOrEmpty(strMaxIconLoc))
                {
                    SetMinMaxProperties(objButton, strMaxIconLoc, Localization.GetString("Maximize"), Localization.GetString("Maximize"));
                }
            }

            if (intAnimationFrames != 5)
            {
                ClientAPI.RegisterClientVariable(objButton.Page, "animf_" + objContent.ClientID, intAnimationFrames.ToString(), true);
            }
        }
 /// <summary>
 /// Executes predefined JS script and gets result value.
 /// </summary>
 /// <param name="scriptName">Name of desired JS script.</param>
 /// <param name="arguments">Script arguments.</param>
 /// <typeparam name="T">Type of return value.</typeparam>
 /// <returns>Script execution result.</returns>
 public T ExecuteScript <T>(JavaScript scriptName, params object[] arguments)
 {
     return(ExecuteScript <T>(scriptName.GetScript(), arguments));
 }
Exemplo n.º 5
0
        private void SavaData()
        {
            string projectCode    = Request["ProjectCode"] + "";
            string act            = Request["Action"] + "";;
            string costCode       = Request["CostCode"] + "";
            string subjectSetCode = this.txtSubjectSetCode.Value;

            if (this.txtCostName.Text.Trim().Length == 0)
            {
                Response.Write(Rms.Web.JavaScript.Alert(true, "请填写费用名称 !"));
                return;
            }

            if (this.txtSortID.Text.Trim().Length == 0)
            {
                Response.Write(Rms.Web.JavaScript.Alert(true, "请填写费用项编号 !"));
                return;
            }

            /*
             * if (this.ucParent.Value.Trim().Length == 0)
             * {
             *  Response.Write(Rms.Web.JavaScript.Alert(true, "请填写上级费用项 !"));
             *  return;
             * }
             */

            if (act == "Modify")
            {
                if (this.ucParent.Value != "")
                {
                    if (costCode == this.ucParent.Value)
                    {
                        Response.Write(Rms.Web.JavaScript.Alert(true, "上级费用项不能是自己 !"));
                        return;
                    }

                    if (BLL.CBSRule.IsChildCBS(this.ucParent.Value, costCode))
                    {
                        Response.Write(Rms.Web.JavaScript.Alert(true, "上级费用项不能是自己的子项 !"));
                        return;
                    }
                }
            }


//			子项费用项对应到科目
//			string subjectCode = this.txtSubjectCode.Text.Trim();
//			if (this.txtSubjectCode.Text.Trim().Length==0)
//			{
//				Response.Write(Rms.Web.JavaScript.Alert(true,"请填写科目编号 !"));
//				return;
//			}

            string subjectCode = "";

            if (this.ucInputSubject.Value != null)
            {
                subjectCode = this.ucInputSubject.Value;
            }

            if (subjectCode != "")
            {
                string subjectName = BLL.SubjectRule.GetSubjectName(subjectCode, this.txtSubjectSetCode.Value);
                if (subjectName == "")
                {
                    Response.Write(Rms.Web.JavaScript.Alert(true, "不存在这个科目编号 !"));
                    return;
                }
            }


            try
            {
                bool   isNew          = false;
                string currentCode    = "";
                string parentCode     = "";
                int    parentDeep     = 0;
                string parentFullCode = "";
                int    deep           = 0;

                EntityData entity = null;
                DataRow    dr     = null;

                if (act == "AddChild")
                {
                    isNew      = true;
                    parentCode = this.ucParent.Value;
                    if (parentCode != "")
                    {
                        EntityData parent = DAL.EntityDAO.CBSDAO.GetCBSByCode(costCode);
                        parentDeep     = parent.GetInt("Deep");
                        parentFullCode = parent.GetString("FullCode");
                        parent.Dispose();
                    }

                    currentCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("CostCode");
                    this.txtTempCostCode.Value = currentCode;
                    entity           = new EntityData("CBS");
                    dr               = entity.GetNewRecord();
                    dr["CostCode"]   = currentCode;
                    dr["ParentCode"] = parentCode;

                    if (parentFullCode == "")
                    {
                        dr["FullCode"] = currentCode;
                    }
                    else
                    {
                        dr["FullCode"] = parentFullCode + "-" + currentCode;
                    }

                    deep                 = parentDeep + 1;
                    dr["Deep"]           = deep;
                    dr["ProjectCode"]    = projectCode;
                    dr["SubjectSetCode"] = subjectSetCode;
                }
                else if (act == "Modify")
                {
                    isNew  = false;
                    entity = DAL.EntityDAO.CBSDAO.GetCBSByCode(costCode);
                    dr     = entity.CurrentRow;
                }

                dr["CostName"]    = this.txtCostName.Text;
                dr["Description"] = this.txtDescription.Text;
                dr["SortID"]      = this.txtSortID.Text.Trim();
                dr["CostAllocationDescription"] = txtCostAllocationDescription.Text;

                dr["SubjectCode"] = subjectCode;
                dr["BudgetType"]  = this.ucBudgetType.Value;

                if (isNew)
                {
                    entity.AddNewRecord(dr);
                    DAL.EntityDAO.CBSDAO.InsertCBS(entity);
                }
                else
                {
                    DAL.EntityDAO.CBSDAO.UpdateCBS(entity);
                }

                //修改上级费用项
                if (entity.GetString("ParentCode") != this.ucParent.Value)
                {
                    BLL.CBSRule.UpdateCBSParent(costCode, this.ucParent.Value);
                }

                entity.Dispose();

                CloseWindow();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(JavaScript.Alert(true, "保存出错:" + ex.Message));
            }
        }
Exemplo n.º 6
0
 public void Lower()
 {
     var p = new { x = 0, y = 1 };
 }
Exemplo n.º 7
0
 public void BuildsStatementWithAdditionalMethod()
 {
     dynamic javaScript = new JavaScript("$(\".test\")");
     string statement = javaScript.Find().Statement;
     statement.ShouldBe("$(\".test\").find()");
 }
Exemplo n.º 8
0
 public static void RegisterJQueryUI(Page page)
 {
     RegisterJQuery(page);
     JavaScript.RequestRegistration(CommonJs.jQueryUI);
 }
Exemplo n.º 9
0
 public static void RegisterDnnJQueryPlugins(Page page)
 {
     RegisterJQueryUI(page);
     RegisterHoverIntent(page);
     JavaScript.RequestRegistration(CommonJs.DnnPlugins);
 }
    protected void OnlinePaymentAlipayToBank(int Count, double SumMoney, string Body, string UserDistillIDs)
    {
        SystemOptions options = new SystemOptions();

        this.partner          = options["OnlinePay_Alipay_ForUserDistill_UserNumber"].ToString("");
        this.key              = options["OnlinePay_Alipay_ForUserDistill_MD5Key"].ToString("");
        this.gateway          = options["MemberSharing_Alipay_Gateway"].ToString("");
        this.service          = "bptb_pay_file";
        this.sign_type        = "MD5";
        this._input_charset   = "GB2312";
        this.file_digest_type = "MD5";
        this.biz_type         = "d_sale";
        this.agentID          = options["OnlinePay_Alipay_ForUserDistill_UserNumber"].ToString("");
        Shove.Alipay.Alipay alipay = new Shove.Alipay.Alipay();
        DateTime            now    = DateTime.Now;
        string str      = "";
        string path     = "";
        string fileName = "";
        string str4     = "";
        int    index    = 0;

        if (((Body != "") && (Count > 0)) && (SumMoney > 0.0))
        {
            string str5 = now.ToString("yyyyMMdd");
            string str7 = "日期,总金额,总笔数,支付宝帐号(Email)\r\n";
            Body = (str7 + str5 + "," + SumMoney.ToString() + "," + Count.ToString() + "," + this.partner + "\r\n") + "商户流水号,收款银行户名,收款银行帐号,收款开户银行,收款银行所在省份,收款银行所在市,收款支行名称,金额,对公对私标志,备注\r\n" + Body;
            Random random = new Random();
            string str8   = (random.Next(1, 0x3e7).ToString() + now.Hour.ToString() + now.Minute.ToString() + now.Second.ToString()).PadLeft(9, '0');
            str      = "PAPX_" + str5 + "_P" + str8 + ".csv".ToLower();
            path     = base.MapPath("../App_Log/Admin/AlipayPayment/PABX/" + str).ToLower();
            fileName = "PAPX_" + str5 + "_P" + str8 + ".Zip".ToLower();
            str4     = base.MapPath("../App_Log/Admin/AlipayPayment/PABX/" + fileName).ToLower();
            if (!System.IO.File.Exists(path))
            {
                try
                {
                    if (!Shove._IO.File.WriteFile(path, Body))
                    {
                        Procedures.P_UserDistillPayByAlipayWriteLog("CSV文件写入失败:" + path);
                        JavaScript.Alert(this.Page, "CSV文件写入失败");
                        return;
                    }
                    if (System.IO.File.Exists(path))
                    {
                        if (System.IO.File.Exists(str4))
                        {
                            goto Label_0388;
                        }
                        try
                        {
                            Shove._IO.File.Compress(path, str4);
                            goto Label_0388;
                        }
                        catch
                        {
                            Procedures.P_UserDistillPayByAlipayWriteLog("文件压缩出现异常:" + path);
                            JavaScript.Alert(this.Page, "文件压缩出现异常");
                            return;
                        }
                    }
                    Procedures.P_UserDistillPayByAlipayWriteLog("CSV文件不存在(1):" + path);
                    JavaScript.Alert(this.Page, "CSV文件不存在");
                    return;
                }
                catch
                {
                    Procedures.P_UserDistillPayByAlipayWriteLog("CSV文件写入异常:" + path);
                    JavaScript.Alert(this.Page, "CSV文件写入异常");
                    return;
                }
            }
            JavaScript.Alert(this.Page, "文件写已存在");
            return;
        }
Label_0388:
        if (!System.IO.File.Exists(str4))
        {
            Procedures.P_UserDistillPayByAlipayWriteLog("ZIP文件不存在(2):" + path);
            JavaScript.Alert(this.Page, "ZIP文件不存在");
        }
        else
        {
            byte[] buffer4;
            byte[] date = System.IO.File.ReadAllBytes(str4);
            this.digest_bptb_pay_file = Shove.Alipay.Alipay.GetMD5(date, this._input_charset);
            string[]   strArray4   = alipay.GetUploadParams(this.service, this._input_charset, this.partner, this.file_digest_type, this.biz_type, this.agentID);
            FileStream stream      = new FileStream(str4, FileMode.Open, FileAccess.Read, FileShare.Read);
            string     contentType = "application/octet-stream";
            byte[]     buffer      = new byte[stream.Length];
            stream.Read(buffer, 0, Convert.ToInt32(stream.Length));
            stream.Close();
            CreateBytes bytes      = new CreateBytes();
            ArrayList   byteArrays = new ArrayList();
            string[]    fields     = new string[strArray4.Length + 1];
            char[]      separator  = new char[] { '=' };
            index = 0;
            while (index < strArray4.Length)
            {
                string fieldName  = strArray4[index].Split(separator)[0];
                string fieldValue = strArray4[index].Split(separator)[1];
                byteArrays.Add(bytes.CreateFieldData(fieldName, fieldValue));
                fields[index] = fieldName + "=" + fieldValue;
                index++;
            }
            byteArrays.Add(bytes.CreateFieldData("digest_bptb_pay_file", this.digest_bptb_pay_file));
            fields[index] = "digest_bptb_pay_file=" + this.digest_bptb_pay_file;
            this.sign     = AlipayCommon.GetSign(fields, this.key).Trim();
            byteArrays.Add(bytes.CreateFieldData("sign", this.sign));
            byteArrays.Add(bytes.CreateFieldData("sign_type", "MD5"));
            byteArrays.Add(bytes.CreateFieldData("bptb_pay_file", str4, contentType, buffer));
            byte[] buffer3 = bytes.JoinBytes(byteArrays);
            if (!bytes.UploadData(this.gateway, buffer3, out buffer4))
            {
                Procedures.P_UserDistillPayByAlipayWriteLog("上传到指定Url失败:" + path);
                try
                {
                    System.IO.File.Delete(path);
                    System.IO.File.Delete(str4);
                }
                catch
                {
                }
                JavaScript.Alert(this.Page, "上传支付数据到指定Url失败!");
            }
            else
            {
                string str12 = Encoding.Default.GetString(buffer4);
                if (str12.IndexOf("上传成功") >= 0)
                {
                    int    returnValue       = 0;
                    string returnDescription = "";
                    if (Procedures.P_UserDistillPayByAlipay(base._User.ID, fileName, UserDistillIDs, 2, ref returnValue, ref returnDescription) < 0)
                    {
                        Procedures.P_UserDistillPayByAlipayWriteLog("提款ID:" + UserDistillIDs + "写入数据库(FileName)和更新状态失败。");
                    }
                    if (returnDescription != "")
                    {
                        Procedures.P_UserDistillPayByAlipayWriteLog("把上传的支付明细写入数据库(FileName)和更新状态出错:" + returnDescription);
                        JavaScript.Alert(this.Page, "出错:" + returnDescription);
                        this.BindData(true);
                    }
                    else
                    {
                        JavaScript.Alert(this.Page, str12 + "银行处理需要到明天才有结果,请耐心等待处理结果!");
                        this.BindData(true);
                    }
                }
                else
                {
                    Procedures.P_UserDistillPayByAlipayWriteLog("上传支付到银行明细失败:" + str12);
                    JavaScript.Alert(this.Page, str12.Replace("\n", "").Replace("\r", ""));
                }
            }
        }
    }
Exemplo n.º 11
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string name = "";

        try
        {
            name = Utility.FilteSqlInfusion(this.tbIsuse.Text.Trim());
        }
        catch
        {
        }
        if (name == "")
        {
            JavaScript.Alert(this.Page, "期号不能为空!");
        }
        else
        {
            DataTable table = new Tables.T_Isuses().Open("[ID]", "[Name] = '" + name + "' and LotteryID = " + Utility.FilteSqlInfusion(this.tbLotteryID.Text), "");
            if (table == null)
            {
                PF.GoError(4, "数据库繁忙,请重试", "Admin_IsuseAdd");
            }
            else if (table.Rows.Count > 0)
            {
                JavaScript.Alert(this.Page, "期号已经存在,请不要输入重名期号!");
            }
            else
            {
                object obj2 = PF.ValidLotteryTime(this.tbStartTime.Text);
                if (obj2 == null)
                {
                    JavaScript.Alert(this.Page, "开始时间格式输入错误!");
                }
                else
                {
                    DateTime startTime = (DateTime)obj2;
                    obj2 = PF.ValidLotteryTime(this.tbEndTime.Text);
                    if (obj2 == null)
                    {
                        JavaScript.Alert(this.Page, "截止时间格式输入错误!");
                    }
                    else
                    {
                        DateTime endTime = (DateTime)obj2;
                        if (endTime <= startTime)
                        {
                            JavaScript.Alert(this.Page, "截止时间应该在开始时间之后!");
                        }
                        else
                        {
                            string additionasXml = "";
                            if ((((((this.tbLotteryID.Text != "1") || (this.BuildAdditionasXmlForSFC(ref additionasXml) >= 0)) && ((this.tbLotteryID.Text != "2") || (this.BuildAdditionasXmlForJQC(ref additionasXml) >= 0))) && ((this.tbLotteryID.Text != "15") || (this.BuildAdditionasXmlForLCBQC(ref additionasXml) >= 0))) && ((this.tbLotteryID.Text != "19") || (this.BuildAdditionasXmlForLCDC(ref additionasXml) >= 0))) && ((this.tbLotteryID.Text != "45") || (this.BuildAdditionasXmlForZCDC(ref additionasXml) >= 0)))
                            {
                                int    lotteryID         = int.Parse(this.tbLotteryID.Text);
                                long   isuseID           = -1L;
                                string returnDescription = "";
                                int    num3 = Procedures.P_IsuseAdd(lotteryID, name, startTime, endTime, additionasXml, ref isuseID, ref returnDescription);
                                if (num3 < 0)
                                {
                                    PF.GoError(4, "数据库繁忙,请重试", "Admin_IsuseAdd");
                                }
                                else if (isuseID < 0L)
                                {
                                    PF.GoError(1, returnDescription, "Admin_IsuseAdd");
                                }
                                else if (new Tables.T_TotalMoney {
                                    IsuseID = { Value = isuseID }, TotalMoney = { Value = this.tbMoney.Text }
                                }.Insert() < 0L)
                                {
                                    JavaScript.Alert(this.Page, "添加奖池奖金失败!");
                                }
                                else
                                {
                                    if ((this.cbAutoNext10Isuse.Visible && this.cbAutoNext10Isuse.Checked) && (additionasXml == ""))
                                    {
                                        string str4 = name.Substring(0, name.Length - 3);
                                        int    num4 = _Convert.StrToInt(name.Substring(name.Length - 3, 3), 0);
                                        for (int i = 1; i <= 9; i++)
                                        {
                                            num4++;
                                            string str5 = str4 + num4.ToString().PadLeft(3, '0');
                                            startTime = startTime.AddDays(1.0);
                                            endTime   = endTime.AddDays(1.0);
                                            Procedures.P_IsuseAdd(lotteryID, str5, startTime, endTime, "", ref isuseID, ref returnDescription);
                                            if (num3 < 0)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                    Shove._Web.Cache.ClearCache("LotteryCalendar");
                                    Shove._Web.Cache.ClearCache(DataCache.IsusesInfo + this.tbLotteryID.Text.Trim());
                                    base.Response.Redirect("Isuse.aspx?LotteryID=" + this.tbLotteryID.Text, true);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 12
0
 private void PageLoad(object sender, System.EventArgs e)
 {
     // request that the DNN framework load the jQuery script into the markup
     JavaScript.RequestRegistration(CommonJs.DnnPlugins);
 }
Exemplo n.º 13
0
 /// <summary>
 /// //Can be called from any handler to trigger the error chain.
 /// </summary>
 /// <param name="val"></param>
 public void Fail(JavaScript.Object val)
 {
 }
Exemplo n.º 14
0
 /// <summary>
 /// Registers a response handler.
 /// </summary>
 /// <param name="context">"this" context for the response method</param>
 /// <param name="handle">object function(sender, val) {}
 /// <para>sender is async object, if it return value other than null, the value is pass to next handler as val.</para>
 /// </param>
 /// <returns></returns>
 public Async Response(JavaScript.Object context, Func<Async, JavaScript.Object, JavaScript.Object> handle)
 {
     return null;
 }
Exemplo n.º 15
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            JavaScript.RequestRegistration(CommonJs.DnnPlugins);

            ClientResourceManager.RegisterScript(Page, "~/Resources/Shared/scripts/dnn.jquery.extensions.js");
            ClientResourceManager.RegisterScript(Page, "~/Resources/Shared/scripts/dnn.jquery.tooltip.js");
            ClientResourceManager.RegisterScript(Page, "~/DesktopModules/Admin/Security/Scripts/dnn.PasswordComparer.js");

            if (PortalSettings.Registration.RegistrationFormType == 0)
            {
                //UserName
                if (!PortalSettings.Registration.UseEmailAsUserName)
                {
                    AddField("Username", String.Empty, true,
                             String.IsNullOrEmpty(PortalSettings.Registration.UserNameValidator) ? ExcludeTerms : PortalSettings.Registration.UserNameValidator,
                             TextBoxMode.SingleLine);
                }

                //Password
                if (!PortalSettings.Registration.RandomPassword)
                {
                    AddPasswordStrengthField("Password", "Membership", true);

                    if (PortalSettings.Registration.RequirePasswordConfirm)
                    {
                        AddPasswordConfirmField("PasswordConfirm", "Membership", true);
                    }
                }

                //Password Q&A
                if (MembershipProviderConfig.RequiresQuestionAndAnswer)
                {
                    AddField("PasswordQuestion", "Membership", true, String.Empty, TextBoxMode.SingleLine);
                    AddField("PasswordAnswer", "Membership", true, String.Empty, TextBoxMode.SingleLine);
                }

                //DisplayName
                if (String.IsNullOrEmpty(PortalSettings.Registration.DisplayNameFormat))
                {
                    AddField("DisplayName", String.Empty, true, String.Empty, TextBoxMode.SingleLine);
                }
                else
                {
                    AddField("FirstName", String.Empty, true, String.Empty, TextBoxMode.SingleLine);
                    AddField("LastName", String.Empty, true, String.Empty, TextBoxMode.SingleLine);
                }

                //Email
                AddField("Email", String.Empty, true, PortalSettings.Registration.EmailValidator, TextBoxMode.SingleLine);

                if (PortalSettings.Registration.RequireValidProfile)
                {
                    foreach (ProfilePropertyDefinition property in User.Profile.ProfileProperties)
                    {
                        if (property.Required)
                        {
                            AddProperty(property);
                        }
                    }
                }
            }
            else
            {
                var fields = PortalSettings.Registration.RegistrationFields.Split(',').ToList();
                //append question/answer field when RequiresQuestionAndAnswer is enabled in config.
                if (MembershipProviderConfig.RequiresQuestionAndAnswer)
                {
                    if (!fields.Contains("PasswordQuestion"))
                    {
                        fields.Add("PasswordQuestion");
                    }
                    if (!fields.Contains("PasswordAnswer"))
                    {
                        fields.Add("PasswordAnswer");
                    }
                }

                foreach (string field in fields)
                {
                    var trimmedField = field.Trim();
                    switch (trimmedField)
                    {
                    case "Username":
                        AddField("Username", String.Empty, true, String.IsNullOrEmpty(PortalSettings.Registration.UserNameValidator)
                                                                                                                                                ? ExcludeTerms : PortalSettings.Registration.UserNameValidator,
                                 TextBoxMode.SingleLine);
                        break;

                    case "Email":
                        AddField("Email", String.Empty, true, PortalSettings.Registration.EmailValidator, TextBoxMode.SingleLine);
                        break;

                    case "Password":
                        AddPasswordStrengthField(trimmedField, "Membership", true);
                        break;

                    case "PasswordConfirm":
                        AddPasswordConfirmField(trimmedField, "Membership", true);
                        break;

                    case "PasswordQuestion":
                    case "PasswordAnswer":
                        AddField(trimmedField, "Membership", true, String.Empty, TextBoxMode.SingleLine);
                        break;

                    case "DisplayName":
                        AddField(trimmedField, String.Empty, true, ExcludeTerms, TextBoxMode.SingleLine);
                        break;

                    default:
                        ProfilePropertyDefinition property = User.Profile.GetProperty(trimmedField);
                        if (property != null)
                        {
                            AddProperty(property);
                        }
                        break;
                    }
                }
            }

            //Verify that the current user has access to this page
            if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.NoRegistration && Request.IsAuthenticated == false)
            {
                Response.Redirect(Globals.NavigateURL("Access Denied"), false);
                Context.ApplicationInstance.CompleteRequest();
            }

            cancelLink.NavigateUrl = closeLink.NavigateUrl = GetRedirectUrl(false);
            registerButton.Click  += registerButton_Click;

            if (PortalSettings.Registration.UseAuthProviders)
            {
                List <AuthenticationInfo> authSystems = AuthenticationController.GetEnabledAuthenticationServices();
                foreach (AuthenticationInfo authSystem in authSystems)
                {
                    try
                    {
                        var authLoginControl = (AuthenticationLoginBase)LoadControl("~/" + authSystem.LoginControlSrc);
                        if (authSystem.AuthenticationType != "DNN")
                        {
                            BindLoginControl(authLoginControl, authSystem);
                            //Check if AuthSystem is Enabled
                            if (authLoginControl.Enabled && authLoginControl.SupportsRegistration)
                            {
                                authLoginControl.Mode = AuthMode.Register;

                                //Add Login Control to List
                                _loginControls.Add(authLoginControl);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Exceptions.LogException(ex);
                    }
                }
            }
        }
Exemplo n.º 16
0
 public static void RegisterHoverIntent(Page page)
 {
     JavaScript.RequestRegistration(CommonJs.HoverIntent);
 }
Exemplo n.º 17
0
 public void RequestAjaxScriptSupport()
 {
     JavaScript.RequestRegistration(CommonJs.jQuery);
     SetKey(ScriptKey);
 }
Exemplo n.º 18
0
 public static void RegisterFileUpload(Page page)
 {
     JavaScript.RequestRegistration(CommonJs.jQueryFileUpload);
 }
Exemplo n.º 19
0
        public void Test()
        {
            var d = new { x = 5 };

            s = "x";
        }
Exemplo n.º 20
0
 public static void RequestRegistration()
 {
     JavaScript.RequestRegistration(CommonJs.jQuery);
     JavaScript.RequestRegistration(CommonJs.jQueryMigrate);
 }
Exemplo n.º 21
0
 /// <summary>
 /// Registers an error handler.
 /// </summary>
 /// <param name="context">"this" context for the response method</param>
 /// <param name="handle">object function(sender, val) {}
 /// <para>sender is async object, if it return value other than null, the value is pass to next handler as val.</para>
 /// </param>
 /// <returns></returns>
 public Async Error(JavaScript.Object context, Func<Async, JavaScript.Object, JavaScript.Object> handle)
 {
     return null;
 }
Exemplo n.º 22
0
 public static void RequestUIRegistration()
 {
     JavaScript.RequestRegistration(CommonJs.jQueryUI);
 }
 /// <summary>
 /// Executes predefined JS script and gets result value.
 /// </summary>
 /// <param name="scriptName">Name of desired JS script.</param>
 /// <param name="arguments">Script arguments.</param>
 /// <returns>Script execution result.</returns>
 public object ExecuteAsyncScript(JavaScript scriptName, params object[] arguments)
 {
     return(ExecuteAsyncScript(scriptName.GetScript(), arguments));
 }
Exemplo n.º 24
0
 public static void RequestDnnPluginsRegistration()
 {
     JavaScript.RequestRegistration(CommonJs.DnnPlugins);
 }
Exemplo n.º 25
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Init runs when the control is initialised
        /// </summary>
        /// <remarks>
        /// </remarks>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            cmdCancel.Click += cmdCancel_Click;
            cmdAdd.Click    += cmdAdd_Click;

            ctlUser.UserCreateCompleted += UserCreateCompleted;
            ctlUser.UserDeleted         += UserDeleted;
            ctlUser.UserRemoved         += UserRemoved;
            ctlUser.UserRestored        += UserRestored;
            ctlUser.UserUpdateCompleted += UserUpdateCompleted;
            ctlUser.UserUpdateError     += UserUpdateError;

            ctlProfile.ProfileUpdateCompleted             += ProfileUpdateCompleted;
            ctlPassword.PasswordUpdated                   += PasswordUpdated;
            ctlPassword.PasswordQuestionAnswerUpdated     += PasswordQuestionAnswerUpdated;
            ctlMembership.MembershipAuthorized            += MembershipAuthorized;
            ctlMembership.MembershipPasswordUpdateChanged += MembershipPasswordUpdateChanged;
            ctlMembership.MembershipUnAuthorized          += MembershipUnAuthorized;
            ctlMembership.MembershipUnLocked              += MembershipUnLocked;
            ctlMembership.MembershipDemoteFromSuperuser   += MembershipDemoteFromSuperuser;
            ctlMembership.MembershipPromoteToSuperuser    += MembershipPromoteToSuperuser;

            JavaScript.RequestRegistration(CommonJs.DnnPlugins);

            //Set the Membership Control Properties
            ctlMembership.ID = "Membership";
            ctlMembership.ModuleConfiguration = ModuleConfiguration;
            ctlMembership.UserId = UserId;

            //Set the User Control Properties
            ctlUser.ID = "User";
            ctlUser.ModuleConfiguration = ModuleConfiguration;
            ctlUser.UserId = UserId;

            //Set the Roles Control Properties
            ctlRoles.ID = "SecurityRoles";
            ctlRoles.ModuleConfiguration = ModuleConfiguration;
            ctlRoles.ParentModule        = this;

            //Set the Password Control Properties
            ctlPassword.ID = "Password";
            ctlPassword.ModuleConfiguration = ModuleConfiguration;
            ctlPassword.UserId = UserId;

            //Set the Profile Control Properties
            ctlProfile.ID = "Profile";
            ctlProfile.ModuleConfiguration = ModuleConfiguration;
            ctlProfile.UserId = UserId;

            //Customise the Control Title
            if (AddUser)
            {
                if (!Request.IsAuthenticated)
                {
                    //Register
                    ModuleConfiguration.ModuleTitle = Localization.GetString("Register.Title", LocalResourceFile);
                }
                else
                {
                    //Add User
                    ModuleConfiguration.ModuleTitle = Localization.GetString("AddUser.Title", LocalResourceFile);
                }

                userContainer.CssClass += " register";
            }
        }
Exemplo n.º 26
0
 public static void RequestHoverIntentRegistration()
 {
     JavaScript.RequestRegistration(CommonJs.HoverIntent);
 }
Exemplo n.º 27
0
 private static void AddBodyOnLoad(Page objPage, string scriptKey, string strJSFunction)
 {
     JavaScript.RegisterClientReference(objPage, ClientAPI.ClientNamespaceReferences.dnn);
     objPage.ClientScript.RegisterStartupScript(objPage.GetType(), scriptKey, strJSFunction, true);
 }
 public RequiresEtexScriptAttribute(JavaScript scriptResource)
 {
     _scriptResource = scriptResource;
 }
Exemplo n.º 29
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Contains the functionality to populate the Root aspx page with controls
        /// </summary>
        /// <param name="e"></param>
        /// <remarks>
        /// - obtain PortalSettings from Current Context
        /// - set global page settings.
        /// - initialise reference paths to load the cascading style sheets
        /// - add skin control placeholder.  This holds all the modules and content of the page.
        /// </remarks>
        /// -----------------------------------------------------------------------------
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //set global page settings
            InitializePage();

            //load skin control and register UI js
            UI.Skins.Skin ctlSkin;
            if (PortalSettings.EnablePopUps)
            {
                ctlSkin = UrlUtils.InPopUp() ? UI.Skins.Skin.GetPopUpSkin(this) : UI.Skins.Skin.GetSkin(this);

                //register popup js
                JavaScript.RequestRegistration(CommonJs.jQueryUI);

                var popupFilePath = HttpContext.Current.IsDebuggingEnabled
                                   ? "~/js/Debug/dnn.modalpopup.js"
                                   : "~/js/dnn.modalpopup.js";

                ClientResourceManager.RegisterScript(this, popupFilePath, FileOrder.Js.DnnModalPopup);
            }
            else
            {
                ctlSkin = UI.Skins.Skin.GetSkin(this);
            }

            // DataBind common paths for the client resource loader
            ClientResourceLoader.DataBind();
            ClientResourceLoader.PreRender += (sender, args) => JavaScript.Register(Page);

            //check for and read skin package level doctype
            SetSkinDoctype();

            //Manage disabled pages
            if (PortalSettings.ActiveTab.DisableLink)
            {
                if (TabPermissionController.CanAdminPage())
                {
                    var heading = Localization.GetString("PageDisabled.Header");
                    var message = Localization.GetString("PageDisabled.Text");
                    UI.Skins.Skin.AddPageMessage(ctlSkin, heading, message,
                                                 ModuleMessage.ModuleMessageType.YellowWarning);
                }
                else
                {
                    if (PortalSettings.HomeTabId > 0)
                    {
                        Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                    }
                    else
                    {
                        Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                    }
                }
            }
            //Manage canonical urls
            if (PortalSettings.PortalAliasMappingMode == PortalSettings.PortalAliasMapping.CanonicalUrl)
            {
                string primaryHttpAlias = null;
                if (Config.GetFriendlyUrlProvider() == "advanced")  //advanced mode compares on the primary alias as set during alias identification
                {
                    if (PortalSettings.PrimaryAlias != null && PortalSettings.PortalAlias != null)
                    {
                        if (string.Compare(PortalSettings.PrimaryAlias.HTTPAlias, PortalSettings.PortalAlias.HTTPAlias, StringComparison.InvariantCulture) != 0)
                        {
                            primaryHttpAlias = PortalSettings.PrimaryAlias.HTTPAlias;
                        }
                    }
                }
                else //other modes just depend on the default alias
                {
                    if (string.Compare(PortalSettings.PortalAlias.HTTPAlias, PortalSettings.DefaultPortalAlias, StringComparison.InvariantCulture) != 0)
                    {
                        primaryHttpAlias = PortalSettings.DefaultPortalAlias;
                    }
                }
                if (primaryHttpAlias != null && string.IsNullOrEmpty(CanonicalLinkUrl))//a primary http alias was identified
                {
                    var originalurl = Context.Items["UrlRewrite:OriginalUrl"].ToString();
                    CanonicalLinkUrl = originalurl.Replace(PortalSettings.PortalAlias.HTTPAlias, primaryHttpAlias);

                    if (UrlUtils.IsSecureConnectionOrSslOffload(Request))
                    {
                        CanonicalLinkUrl = CanonicalLinkUrl.Replace("http://", "https://");
                    }
                }
            }

            //check if running with known account defaults
            if (Request.IsAuthenticated && string.IsNullOrEmpty(Request.QueryString["runningDefault"]) == false)
            {
                var userInfo      = HttpContext.Current.Items["UserInfo"] as UserInfo;
                var usernameLower = userInfo?.Username?.ToLowerInvariant();
                //only show message to default users
                if ("admin".Equals(usernameLower) || "host".Equals(usernameLower))
                {
                    var messageText  = RenderDefaultsWarning();
                    var messageTitle = Localization.GetString("InsecureDefaults.Title", Localization.GlobalResourceFile);
                    UI.Skins.Skin.AddPageMessage(ctlSkin, messageTitle, messageText, ModuleMessage.ModuleMessageType.RedError);
                }
            }

            //add CSS links
            ClientResourceManager.RegisterDefaultStylesheet(this, string.Concat(Globals.ApplicationPath, "/Resources/Shared/stylesheets/dnndefault/7.0.0/default.css"));
            ClientResourceManager.RegisterIEStylesheet(this, string.Concat(Globals.HostPath, "ie.css"));

            ClientResourceManager.RegisterStyleSheet(this, string.Concat(ctlSkin.SkinPath, "skin.css"), FileOrder.Css.SkinCss);
            ClientResourceManager.RegisterStyleSheet(this, ctlSkin.SkinSrc.Replace(".ascx", ".css"), FileOrder.Css.SpecificSkinCss);

            //add skin to page
            SkinPlaceHolder.Controls.Add(ctlSkin);

            ClientResourceManager.RegisterStyleSheet(this, string.Concat(PortalSettings.HomeDirectory, "portal.css"), FileOrder.Css.PortalCss);

            //add Favicon
            ManageFavicon();

            //ClientCallback Logic
            ClientAPI.HandleClientAPICallbackEvent(this);

            //add viewstateuserkey to protect against CSRF attacks
            if (User.Identity.IsAuthenticated)
            {
                ViewStateUserKey = User.Identity.Name;
            }

            //set the async postback timeout.
            if (AJAX.IsEnabled())
            {
                AJAX.GetScriptManager(this).AsyncPostBackTimeout = Host.AsyncTimeout;
            }
        }
Exemplo n.º 30
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                base.OnInit(e);

                JavaScript.RequestRegistration(CommonJs.DnnPlugins);

                var folderId = Convert.ToInt32(this.Request.Params["FolderId"]);
                this.Folder         = FolderManager.Instance.GetFolder(folderId);
                this.HasFullControl = this.UserInfo.IsSuperUser || FolderPermissionController.HasFolderPermission(this.Folder.FolderPermissions, "FULLCONTROL");

                FolderViewModel rootFolder;
                switch (SettingsRepository.GetMode(this.ModuleId))
                {
                case DigitalAssestsMode.Group:
                    var groupId = Convert.ToInt32(this.Request.Params["GroupId"]);
                    rootFolder = this.controller.GetGroupFolder(groupId, this.PortalSettings);
                    if (rootFolder == null)
                    {
                        throw new Exception("Invalid group folder");
                    }

                    break;

                case DigitalAssestsMode.User:
                    rootFolder = this.controller.GetUserFolder(this.PortalSettings.UserInfo);
                    break;

                default:
                    rootFolder = this.controller.GetRootFolder(this.ModuleId);
                    break;
                }

                this.isRootFolder    = rootFolder.FolderID == folderId;
                this.folderViewModel = this.isRootFolder ? rootFolder : this.controller.GetFolder(folderId);

                // Setup controls
                this.CancelButton.Click += this.OnCancelClick;
                this.SaveButton.Click   += this.OnSaveClick;
                this.PrepareFolderPreviewInfo();
                this.cmdCopyPerm.Click += this.cmdCopyPerm_Click;

                var mef = new ExtensionPointManager();
                var folderFieldsExtension = mef.GetUserControlExtensionPointFirstByPriority("DigitalAssets", "FolderFieldsControlExtensionPoint");
                if (folderFieldsExtension != null)
                {
                    this.folderFieldsControl    = this.Page.LoadControl(folderFieldsExtension.UserControlSrc);
                    this.folderFieldsControl.ID = this.folderFieldsControl.GetType().BaseType.Name;
                    this.FolderDynamicFieldsContainer.Controls.Add(this.folderFieldsControl);
                    var fieldsControl = this.folderFieldsControl as IFieldsControl;
                    if (fieldsControl != null)
                    {
                        fieldsControl.SetController(this.controller);
                        fieldsControl.SetItemViewModel(new ItemViewModel
                        {
                            ItemID   = this.folderViewModel.FolderID,
                            IsFolder = true,
                            PortalID = this.folderViewModel.PortalID,
                            ItemName = this.folderViewModel.FolderName,
                        });
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Exemplo n.º 31
0
        /// <summary>
        /// 保存数据
        /// </summary>
        public void SaveData()
        {
            try
            {
                if ("" == this.SelectModelCode.Value.Trim())
                {
                    Response.Write(JavaScript.Alert(true, "请选择户型!"));
                    return;
                }

                if ("" == this.HideBuildingModelCode.Value.Trim())
                {
                    #region --- 新增 -------------------------------------------------------------------------

                    EntityData entity = new EntityData("BuildingModel");
                    DataRow    dr     = entity.GetNewRecord();

                    dr["BuildingModelCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode(BuildingModelCode);
                    dr["BuildingCode"]      = this.HideBuildingCode.Value;

                    dr["ModelCode"] = this.SelectModelCode.Value;

                    if ("" != this.SelectBuildingStationCode.Value.Trim())
                    {
                        dr["BuildingStationCode"] = this.SelectBuildingStationCode.Value;
                    }
                    else
                    {
                        dr["BuildingStationCode"] = DBNull.Value;
                    }

                    if ("" != this.SelectBuildingFunctionCode.Value.Trim())
                    {
                        dr["BuildingFunctionCode"] = this.SelectBuildingFunctionCode.Value;
                    }
                    else
                    {
                        dr["BuildingFunctionCode"] = DBNull.Value;
                    }

                    if (StringCheck.IsInt(this.TextBModelNum.Value))
                    {
                        dr["BModelNum"] = this.TextBModelNum.Value;
                    }
                    else
                    {
                        dr["BModelNum"] = DBNull.Value;
                    }

                    if (StringCheck.IsNumber(this.TextBModelArea.Value))
                    {
                        dr["BModelArea"] = this.TextBModelArea.Value;
                    }
                    else
                    {
                        dr["BModelArea"] = DBNull.Value;
                    }

                    dr["BModelRemark"] = this.TextAreaBModelRemark.Value;

                    entity.AddNewRecord(dr);
                    DAL.EntityDAO.ProductDAO.SubmitAllBuildingModel(entity);
                    entity.Dispose();

                    #endregion -------------------------------------------------------------------------
                }
                else
                {
                    #region --- 修改 -------------------------------------------------------------------------

                    EntityData entity = DAL.EntityDAO.ProductDAO.GetBuildingModelByCode(this.HideBuildingModelCode.Value.Trim());
                    DataRow    dr     = entity.CurrentRow;

                    dr["ModelCode"] = this.SelectModelCode.Value;

                    if ("" != this.SelectBuildingStationCode.Value.Trim())
                    {
                        dr["BuildingStationCode"] = this.SelectBuildingStationCode.Value;
                    }
                    else
                    {
                        dr["BuildingStationCode"] = DBNull.Value;
                    }

                    if ("" != this.SelectBuildingFunctionCode.Value.Trim())
                    {
                        dr["BuildingFunctionCode"] = this.SelectBuildingFunctionCode.Value;
                    }
                    else
                    {
                        dr["BuildingFunctionCode"] = DBNull.Value;
                    }

                    if (StringCheck.IsInt(this.TextBModelNum.Value))
                    {
                        dr["BModelNum"] = this.TextBModelNum.Value;
                    }
                    else
                    {
                        dr["BModelNum"] = DBNull.Value;
                    }

                    if (StringCheck.IsNumber(this.TextBModelArea.Value))
                    {
                        dr["BModelArea"] = this.TextBModelArea.Value;
                    }
                    else
                    {
                        dr["BModelArea"] = DBNull.Value;
                    }

                    dr["BModelRemark"] = this.TextAreaBModelRemark.Value;

                    DAL.EntityDAO.ProductDAO.SubmitAllBuildingModel(entity);
                    entity.Dispose();

                    #endregion -------------------------------------------------------------------------
                }
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
            }
        }
 protected void btnSend_Click(object sender, EventArgs e)
 {
     if (this.tbContent.Text.Trim() == "")
     {
         JavaScript.Alert(this.Page, "请输入短消息内容。");
     }
     else if (this.cbSystemMessage.Checked)
     {
         this.SendSystemMessage();
     }
     else if (this.tbAim.Text.Trim() == "")
     {
         JavaScript.Alert(this.Page, "请输入接收方用户名。");
     }
     else
     {
         string[] aimNames = this.GetAimNames(this.tbAim.Text.Trim());
         if (aimNames.Length < 1)
         {
             JavaScript.Alert(this.Page, "请输入正确的接收方用户名。");
         }
         else
         {
             int    num  = 0;
             int    num2 = 0;
             string str  = "";
             for (int i = 0; i < aimNames.Length; i++)
             {
                 if (aimNames[i] == base._User.Name)
                 {
                     num2++;
                     str = str + "用户 " + aimNames[i] + " 不能发送消息给自己!<br />";
                 }
                 else
                 {
                     Users users = new Users(base._Site.ID)[base._Site.ID, aimNames[i]];
                     if (users == null)
                     {
                         num2++;
                         str = str + "用户 " + aimNames[i] + " 不存在!<br />";
                     }
                     else if (PF.SendStationSMS(base._Site, base._User.ID, users.ID, 2, this.tbContent.Text.Trim()) < 0)
                     {
                         num2++;
                         str = str + "用户 " + aimNames[i] + " 发送错误!<br />";
                     }
                     else
                     {
                         num++;
                         str = str + "用户 " + aimNames[i] + " 发送成功。<br />";
                     }
                 }
             }
             this.labSendResult.Text = "发送结果:成功 " + num.ToString() + " 个,失败 " + num2.ToString() + " 个。<br />" + str;
             if (num2 == 0)
             {
                 this.tbAim.Text              = "";
                 this.tbContent.Text          = "";
                 this.cbSystemMessage.Checked = false;
             }
         }
     }
 }
Exemplo n.º 33
0
        protected void btnOK_ServerClick(object sender, System.EventArgs e)
        {
            string projectCode    = Request["ProjectCode"] + "";
            string subjectSetCode = BLL.ProjectRule.GetSubjectSetCodeByProject(projectCode);

            try
            {
                if (this.txtFile.PostedFile.FileName == "")
                {
                    Response.Write(Rms.Web.JavaScript.Alert(true, "请选择文件"));
                    return;
                }

                StreamReader m_sr = new StreamReader(this.txtFile.PostedFile.InputStream, System.Text.Encoding.Default);

                //第1行是标题
                if (m_sr.Peek() >= 0)
                {
                    m_sr.ReadLine();
                }

                EntityData cbs = DAL.EntityDAO.CBSDAO.GetCBSByProject(projectCode);
//				EntityData cost = DAL.EntityDAO.CBSDAO.GetCostByProject(projectCode);

                while (m_sr.Peek() >= 0)
                {
                    string s = m_sr.ReadLine();

                    string[] sss = BLL.ImportRule.SplitCsvLine(s);

                    if (sss.Length <= 1)
                    {
                        continue;
                    }

                    string sortID = sss[0];
                    int    re     = 0;
                    Math.DivRem(sortID.Length, 2, out re);
                    if (re == 1)
                    {
                        sortID = "0" + sortID;
                    }


                    DataRow[] drsSelect = cbs.CurrentTable.Select(String.Format("SortID='{0}'", sortID));
                    DataRow   dr        = null;

                    bool isNew = (drsSelect.Length == 0);
                    if (isNew)
                    {
                        dr = cbs.GetNewRecord();
                        string costCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("CostCode");
                        dr["CostCode"]    = costCode;
                        dr["SortID"]      = sortID;
                        dr["ProjectCode"] = projectCode;
                        string parentFullCode = "";
                        int    parentDeep     = 0;
                        string parentCode     = "";
                        string parentSortID   = "";
                        if (sortID.Length >= 2)
                        {
                            parentSortID = sortID.Substring(0, sortID.Length - 2);
                            DataRow[] drsP = cbs.CurrentTable.Select(String.Format("SortID='{0}'", parentSortID));
                            if (drsP.Length > 0)
                            {
                                parentDeep     = (int)drsP[0]["Deep"];
                                parentCode     = (string)drsP[0]["CostCode"];
                                parentFullCode = (string)drsP[0]["FullCode"];
                            }
                        }

                        int deep = parentDeep + 1;
                        dr["Deep"]           = deep;
                        dr["ParentCode"]     = parentCode;
                        dr["SubjectSetCode"] = subjectSetCode;
                        if (parentCode == "")
                        {
                            dr["FullCode"] = costCode;
                        }
                        else
                        {
                            dr["FullCode"] = parentFullCode + "-" + costCode;
                        }

                        cbs.AddNewRecord(dr);

                        /*
                         * DataRow drCost = cost.GetNewRecord();
                         * drCost["CostItemCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("CostItemCode");
                         * drCost["CostCode"] = costCode;
                         * drCost["ProjectCode"] = projectCode;
                         * drCost["Flag"] = -1;
                         * drCost["TotalMoney"] = decimal.Zero;
                         * drCost["ModifyPerson"] = base.user.UserCode;
                         * drCost["ModifyDate"] = DateTime.Now.Date;
                         *
                         * // AccountPoint: 0 不作预算、1 做了预算、 2 不是控制点,是子预算统计上来的
                         *
                         * if ( deep == 1 )
                         *      drCost["AccountPoint"] = 1;
                         * else
                         *      drCost["AccountPoint"] = 0;
                         *
                         * cost.AddNewRecord(drCost);
                         */
                    }
                    else
                    {
                        dr = drsSelect[0];
                    }

                    dr["CostName"] = sss[1];

                    if (sss.Length >= 3)
                    {
                        dr["SubjectCode"] = sss[2];
                    }
                    if (sss.Length >= 4)
                    {
                        dr["CostAllocationDescription"] = sss[3];
                    }
                    if (sss.Length >= 5)
                    {
                        dr["Description"] = sss[4];
                    }
                }

                using (StandardEntityDAO dao = new StandardEntityDAO("CBS"))
                {
                    dao.BeginTrans();
                    try
                    {
                        dao.SubmitEntity(cbs);

                        /*
                         * dao.EntityName = "Cost";
                         * dao.SubmitEntity(cost);
                         */

                        dao.CommitTrans();
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            dao.RollBackTrans();
                        }
                        catch
                        {
                        }

                        throw ex;
                    }
                }

                cbs.Dispose();
//				cost.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(JavaScript.Alert(true, "导入出错:" + ex.Message));
                return;
            }

            Response.Write(JavaScript.ScriptStart);
            Response.Write(JavaScript.Alert(false, "导入完成 !"));
            Response.Write(JavaScript.OpenerReload(false));
            Response.Write("window.close();");
            Response.Write(JavaScript.ScriptEnd);
        }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        int num = 0;

        try
        {
            num = _Convert.StrToInt(this.tbIsuse.Text.Trim(), 0);
        }
        catch
        {
        }
        if (num == 0)
        {
            JavaScript.Alert(this.Page, "彩友报期号只能是整数!");
        }
        else
        {
            DateTime time;
            DateTime time2;
            try
            {
                time = Convert.ToDateTime(this.tbStartTime.Text);
            }
            catch
            {
                JavaScript.Alert(this.Page, "开始时间格式输入错误!");
                return;
            }
            try
            {
                time2 = Convert.ToDateTime(this.tbEndTime.Text);
            }
            catch
            {
                JavaScript.Alert(this.Page, "截止时间格式输入错误!");
                return;
            }
            if (time2 >= time)
            {
                string str = _Convert.ToTextCode(this.tbContent.Value.Trim());
                if (str == "")
                {
                    JavaScript.Alert(this.Page, "请输入开奖信息!");
                }
                else if (this.HidID.Value == "")
                {
                    DataTable table = new Tables.T_NewsPaperIsuses().Open("[ID]", "[Name] = '" + num.ToString().PadLeft(this.tbIsuse.Text.Length, '0') + "'", "");
                    if (table == null)
                    {
                        PF.GoError(4, "数据库繁忙,请重试", "Admin_Admin_NPIsusesAdd");
                    }
                    else if (table.Rows.Count > 0)
                    {
                        JavaScript.Alert(this.Page, "期号已经存在,请不要输入重名期号!");
                    }
                    else if (new Tables.T_NewsPaperIsuses {
                        Name = { Value = num.ToString().PadLeft(this.tbIsuse.Text.Length, '0') }, StartTime = { Value = time.ToString("yyyy-MM-dd") }, EndTime = { Value = time2.ToString("yyyy-MM-dd") }, NPMessage = { Value = str }
                    }.Insert() < 0L)
                    {
                        JavaScript.Alert(this.Page, "添加彩友报期号失败!");
                    }
                    else
                    {
                        Shove._Web.Cache.ClearCache("Home_Room_NewsPaper_BindNewsPaper_" + this.HidID.Value);
                        JavaScript.Alert(this.Page, "添加期号成功!");
                    }
                }
                else
                {
                    DataTable table2 = new Tables.T_NewsPaperIsuses().Open("[ID]", "[Name] = '" + num.ToString().PadLeft(this.tbIsuse.Text.Length, '0') + "' and ID<>" + this.HidID.Value, "");
                    if (table2 == null)
                    {
                        PF.GoError(4, "数据库繁忙,请重试", "Admin_IsuseAdd");
                    }
                    else if (table2.Rows.Count > 0)
                    {
                        JavaScript.Alert(this.Page, "期号已经存在,请不要输入重名期号!");
                    }
                    else if (new Tables.T_NewsPaperIsuses {
                        Name = { Value = num.ToString().PadLeft(this.tbIsuse.Text.Length, '0') }, StartTime = { Value = time }, EndTime = { Value = time2 }, NPMessage = { Value = str }
                    }.Update("ID=" + this.HidID.Value) < 0L)
                    {
                        JavaScript.Alert(this.Page, "修改失败!");
                    }
                    else
                    {
                        Shove._Web.Cache.ClearCache("Home_Room_NewsPaper_BindNewsPaper_" + this.HidID.Value);
                        JavaScript.Alert(this.Page, "修改成功!");
                    }
                }
            }
            else
            {
                JavaScript.Alert(this.Page, "截止时间应该在开始时间之后!");
            }
        }
    }
Exemplo n.º 35
0
        public Contact(string id = null, string displayName = null, string name = null, string nickname=null, ContactField[] phoneNumbers = null, ContactField[] emails = null, ContactAddress[] addresses = null,
    ContactField[] ims = null, ContactOrganization[] organizations = null, JavaScript.DOM.IDate birthday = null, string note=null, ContactField[] photos = null, ContactField[] categories = null, ContactField[] urls = null)
        {

        }
Exemplo n.º 36
0
 protected void Page_Load(object sender, EventArgs e)
 {
     JavaScript.RequestRegistration(CommonJs.DnnPlugins);
 }
Exemplo n.º 37
0
 public void Upper()
 {
     var p = new { X = 0, Y = 1 };
 }
Exemplo n.º 38
0
 public void Setup()
 {
     ClassUnderTest = JavaScript.CreateJQuery("$(.test)");
     _executor      = MockRepository.GenerateMock <IJavaScriptExecutor>();
 }
Exemplo n.º 39
0
 public string BuildsSelectorWithAdditionalMethodTwoParameters(object param1, object param2)
 {
     dynamic javaScript = new JavaScript("$(\".test\")");
     return (string) javaScript.Find(param1, param2).Statement;
 }
 /// <summary>
 /// Executes predefined JS script.
 /// </summary>
 /// <param name="scriptName">Name of desired JS script.</param>
 /// <param name="arguments">Script arguments.</param>
 public void ExecuteScript(JavaScript scriptName, params object[] arguments)
 {
     ExecuteScript(scriptName.GetScript(), arguments);
 }
Exemplo n.º 41
0
 public void LowerCasesFirstLetterOnly()
 {
     dynamic javaScript = new JavaScript("$(\".test\")");
     string selector = javaScript.CamelCaseWords().Statement;
     selector.ShouldBe("$(\".test\").camelCaseWords()");
 }
 public void Setup()
 {
     ClassUnderTest = JavaScript.CreateJQuery("$(.test)");
     _executor = MockRepository.GenerateMock<IJavaScriptExecutor>();
 }